Question

I want to use MongoDB River for ElasticSearch, but for this purpose I need to convert my standalone to replica set.

I followed the official documentation but, I encounter this message when going through Step 2:

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

Some references say I need to run rs.initiate(), but how can I do this while the Mongo server is shutdown?

Was it helpful?

Solution

take a break and read the documentation with calm :) they don't say to just shut down the server, they say to shut down your actual mongo istance (because that one is been started as a standalone instance), and right after to start again that instance with a different string, they give that in example:

mongod --port 27017 --dbpath /srv/mongodb/db0 --replSet rs0

where --dbpath point to the path of your datafiles. rs0 is the name of the replicaset, choose your one or just use this

then you can run rs.initiate()

BUT: if you already made some try, and you runned an rs.initiate() without succed, you have to do something before repeat all the procedure:

  1. start the server in your usual way (single instance)
  2. connect to the instance with a similar command : mongo --port 27017
  3. look at your databases : show dbs
  4. if there is a db called local, connect to it: use local
  5. drop that database : db.dropDatabase()

then you can repeat all the procedure and try to properly set up your replicaset.

OTHER TIPS

It says clearly on the next 2 steps what needs to be done.

Use mongo console to connect to the MongoDB server and then run rs.initiate()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top