Reputation: 975
In ref to mongo dba course trying to create replica set as asked shown by instructor in El Capitano (Single machine only), I get following error. I have three members:
(mongodb was installed using homebrew)
Step I: Setting up config cfg ={ _id :"abc", members:[{_id:0, host:"localhost:27001"}, {_id:1, host:"localhost:27002"}, {_id:2, host:"localhost:27003"}] } { "_id" : "abc", "members" : [ { "_id" : 0, "host" : "localhost:27001" }, { "_id" : 1, "host" : "localhost:27002" }, { "_id" : 2, "host" : "localhost:27003" } ] }
STEP II: Initialize the Config.
rs.reconfig(cfg) 2015-10-05T11:34:27.082-0400 E QUERY Error: Could not retrieve replica set config: { "ok" : 0, "errmsg" : "not running with --replSet", "code" : 76 } at Function.rs.conf (src/mongo/shell/utils.js:1017:11) at Function.rs.reconfig (src/mongo/shell/utils.js:969:22) at (shell):1:4 at src/mongo/shell/utils.js:1017
Upvotes: 0
Views: 3312
Reputation: 9823
Make sure you have the replSetName
name configured in /etc/mongod.conf
replication:
replSetName: "somename"
Then restart your mongod.
sudo service mongod stop
sudo service mongod start
sudo service mongod restart
Upvotes: 2
Reputation: 8111
You are not running replica set with the repl set name.The solution is to set a replication set name in the mongod config file using the paramater --replSet
.
eg) --replSet=test_replica
Once changes are done in config file restart the server.
Upvotes: 0