Pymongo.errors.OperationFailure: error

I started 3 mongodprocess each on different portwith different dbpath.

./bin/mongod --replSet foo/tauquir:27018,tauquir:27019 --rest
./bin/mongod --port 27018 --dbpath /data/db1 --replSet foo/tauquir:27017 --rest
./bin/mongod --port 27019 --dbpath /data/db2 --replSet foo/tauquir:27017 --rest

Start the connection as:

CONN = Connection("tauquir:27017", slave_okay=True)
CONN.admin.command("replSetInitiate")
CONN = Connection(["tauquir:27018", "tauquir:27019"])

Traceback I get:

     CONN.admin.command("replSetInitiate")
              File "/usr/local/lib/python2.6/dist-packages/pymongo-1.9-py2.6-linux-
        i686.egg/pymongo/database.py", line 293, in command msg, allowable_errors)
              File "/usr/local/lib/python2.6/dist-packages/pymongo-1.9-py2.6-linux- 
    i686.egg/pymongo/helpers.py", line 119, in _check_command_response raise 
OperationFailure(msg % response["errmsg"])
            pymongo.errors.OperationFailure: command SON([('replSetInitiate', 1)]) failed: 

all members and seeds must be reachable to initiate set
+5
source share
1 answer

replSetInitiate is a one-time command, so you probably don't want it to be encoded with your init connection, but after this line you need to create an instance of your python client with connection information for all 3 mongod servers.

In your example, you replace your variable with a CONNconnection only with 27018 and 27019

db = Connection(["tauquir:27017", "tauquir:27018", "tauquir:27019"])
+1
source

All Articles