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?


Simple, start your replica sets nodes with --replSet xxx (where xxx is your replica set name) -parameter. If you use config files, then replication.replSetName: xxx

Read here how to configure/deploy replica set.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.