当前位置:首页 > 开发 > 互联网 > 正文

pymongo 副本及链接 说明

发表于: 2014-11-16   作者:cooler1217   来源:转载   浏览:
摘要: ReplicaSetConnection('%s:27018,%s:27018,%s:27018' % ('ip0','ip2','ip1'), replicaSet = 'rs0', read_preference=0)['beehoo'] read_preference 解释: | |  NEAREST = 4 | |  PRIMARY = 0
ReplicaSetConnection('%s:27018,%s:27018,%s:27018' % ('ip0','ip2','ip1'), replicaSet = 'rs0', read_preference=0)['beehoo']


read_preference 解释:

|
|  NEAREST = 4
|
|  PRIMARY = 0
|
|  PRIMARY_PREFERRED = 1
|
|  SECONDARY = 2
|
|  SECONDARY_ONLY = 2
|
|  SECONDARY_PREFERRED = 3



MongoReplicaSetClient:

PRIMARY: Queries are sent to the primary of the replica set.
PRIMARY_PREFERRED: Queries are sent to the primary if available, otherwise a secondary.
SECONDARY: Queries are distributed among secondaries. An error is raised if no secondaries are available.
SECONDARY_PREFERRED: Queries are distributed among secondaries, or the primary if no secondary is available.
NEAREST: Queries are distributed among all members.

pymongo 副本及链接 说明

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号