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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Works as Designed
    • 3.7.2
    • None
    • API, Auth, Config
    • None
    • Python 3.7, Centos 7, mongodb 4.2

    Description

      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.

       

       

       

       

       

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: