I am getting this error
{ "ok" : 0, "errmsg" : "server is not running with --replSet" }
when I run the command on windows cmd
rs.initiate( { _id : "repl1", members: [ { _id : 0, host : "mongodb0.example.net:27017" } ] })
I changed it to
rs.initiate( { _id : "repl1", members: [ { _id : 0, host : "localhost:27017" } ] })
but still have same error
how can I fix this issue?
Best Answer
Simple, start your replica sets nodes with
--replSet xxx
(where xxx is your replica set name) -parameter. If you use config files, thenreplication.replSetName: xxx
Read here how to configure/deploy replica set.