I started 3 mongod
process each on different port
with 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
Started the connection as:
CONN = Connection("tauquir:27017", slave_okay=True)
CONN.admin.command("replSetInitiate")
CONN = Connection(["tauquir:27018", "tauquir:27019"])
Traceback I am getting:
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
replSetInitiate is a one time command so you probably don't want that coded with your connection init, but after that line you need to instantiate your python client with connection information for all 3 mongod servers.
In your example you are replacing your CONN
variable with a connection only to 27018 and 27019
db = Connection(["tauquir:27017", "tauquir:27018", "tauquir:27019"])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With