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/
rs.initiate(configuration) Initiates a replica set. Optionally, the method can take an argument in the form of a document that holds the configuration of a replica set. The rs.initiate() method has the following parameter: Parameter.
Definition. rs.status() Returns the replica set status from the point of view of the member where the method is run. This method provides a wrapper around the replSetGetStatus command.
To reset the configuration, make sure every node in your replica set is stopped. Then delete the "local" database for every node. Once you are confident all nodes are not running and the local database are gone, start the mongod process again (of course using the --replSet flag). Then run rs.
Refer official doc deploy-replica-set to setup mongo replica set.
specifies the replica set name through the --replSet command-line option:
mongod --replSet "rs0"
You can also specify the replica set name in a configuration file.
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} )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With