MongoDB: replSet can't get local.system.replset config from self or any seed "server is not running with --replSet"

Senju picture Senju · Aug 10, 2015 · Viewed 9.4k times · Source

I try to setup a Replica Set on Ubuntu 14.04 x64. First error I run into when trying

$ sudo mongod --port 27017 --replSet rs0:

replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)

I read that > rs.initiate() solves that issue, so I do

$ sudo service mongod start
$ mongo
rs.initiate()

which throws:

{ "ok" : 0, "errmsg" : "server is not running with --replSet" }

So if I can't start mongod with --replSet how can I solve the error within rs.initiate() which I need to solve the first error? It's like a vicious circle!

Answer

Senju picture Senju · Aug 11, 2015

Solved the problem by using a second command shell:

console1:

$ sudo mongod --port 27017 --replSet rs0

console2:

$ mongo
  > rs.initiate()