5

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!

2 Answers 2

7

Solved the problem by using a second command shell:

console1:

$ sudo mongod --port 27017 --replSet rs0

console2:

$ mongo
  > rs.initiate()
2

you can set this replSet in /etc/mongodb.conf file,

# Replication
replication:
   replSetName: rs0

#fork
processManagement:
   fork: true

Fork for running in background.

Now start mongod,

mongod --config /etc/mongod.conf

To check the process status,

ps aux | grep mongod

Refer : https://docs.mongodb.org/manual/administration/configuration/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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