error in using rs.initiate() in mongo

arman picture arman · Dec 23, 2016 · Viewed 14.7k times · Source

I want to turn on the replication in monga. So when I tried to use rs.initiate I get the following errorrs.initiate()

{
    "ok" : 0,
    "errmsg" : "This node was not started with the replSet option",
    "code" : 76,
    "codeName" : "NoReplicationEnabled"
}

I am new to this so I don't know how to correct it. I am following these guidelines https://blog.jixee.me/how-to-use-mongo-connector-with-elasticsearch/

Answer

piyush sachdeva picture piyush sachdeva · Oct 24, 2018

If you are running on windows, it might have been running as a service and probably you are still connected with your old server.

use the below command to shutdown any running instance and then start all the instances again:

db.adminCommand( { shutdown : 1} )