Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2044

not connect pymongo in replicaset (No replica set members match selector "Primary()")

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.7.2
    • Component/s: API, Auth, Config
    • None
    • Environment:
      Python 3.7, Centos 7, mongodb 4.2

      Hi,

      I can't connect to my replica pymongo primary.

      from pymongo import MongoClient, ReadPreference

       

      conn = MongoClient('mongodb://user:pass#@hmaster:20017/admin' ,connect=False, replicaSet='Replic', read_preference=ReadPreference.PRIMARY)

       

      config =

      {'_id': 'perconaReplic', 'members': [ \{'_id': 0, 'host': 'HMaster:20017'}

      ,
      {'_id': 1, 'host': 'HMaster:40018'},
      {'_id': 2, 'host': 'HMaster:40019'}]}

       

      conn.admin.command('replSetInitiate', config)

       

      ServerSelectionTimeoutError: No replica set members match selector "Primary()"

       

      through the shell I usually connect.

       

       

       

       

       

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            cream3@gmail.com marcio silveira santos
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: