Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 675
Senju Avatar asked Aug 10 '15 18:08

Senju


1 Answers

Solved the problem by using a second command shell:

console1:

$ sudo mongod --port 27017 --replSet rs0

console2:

$ mongo
  > rs.initiate()
like image 128
Senju Avatar answered Oct 01 '22 09:10

Senju