Failed on setting replica set . System throwing error message saying node was not started with replSet

4,425 views
Skip to first unread message

Dung Tran

unread,
Jul 5, 2017, 9:52:20 AM7/5/17
to mongodb-user
Good morning,
   Hope you have a good week. I am struggling with setting up a mongo db replicate set . It keeps giving me the error message saying the node was not started with the replSet option.  I am trying to figure why and I would like to get to get your helps and advices if you could provided me any.

I was creating an instance of mongo db using my default port 27107 and replSet test as following : 
      mongod --port 27017 --dbpath "\data\db" --replSet test

The instance was created OK : 

2017-07-05T09:22:26.841-0400 I REPL     [initandlisten] Did not find local replica set configuration document at startup;  NoMatchingDocument: Did not find replica set configuration document in local.system.replset

2017-07-05T09:22:26.841-0400 I NETWORK  [thread1] waiting for connections on port 27017



I was trying to connect to the instance and to configure my replica set as follow:


 mongo --port 27017


 cfg = {_id : "test",

        members : [

                    { _id : 0,

                      host : "127.0.0.1:27017"}]}


The system took my config and it came back saying :

{

"_id" : "test",

"members" : [

{

"_id" : 0,

"host" : "127.0.0.1:27017"

}

]

}



However when I did rs.initiate (cfg), it was throwing an error saying this node was not started with the replSet option


"ok" : 0,

"errmsg" : "This node was not started with the replSet option",

"code" : 76,

"codeName" : "NoReplicationEnabled"

}


Please help if you could.


Many Thanks!!

Tom



Kevin Adistambha

unread,
Jul 27, 2017, 7:27:36 PM7/27/17
to mongodb-user

Hi Tom

It’s been a while since you posted this question. Have you found out what happened?

I followed the steps you described using MongoDB 3.4.6, but found that the replica set was initiated properly. The steps I did:

$ mongod --dbpath data --replSet test
....
2017-07-28T09:17:35.026+1000 I REPL     [initandlisten] Did not find local replica set configuration document at startup;  NoMatchingDocument: Did not find replica set configuration document in local.system.replset
2017-07-28T09:17:35.026+1000 I NETWORK  [thread1] waiting for connections on port 27017
....

and in the mongo shell:

> cfg = {_id:'test', members:[{_id:0,host:'127.0.0.1:27017'}]}
{
  "_id": "test",
  "members": [
    {
      "_id": 0,
      "host": "127.0.0.1:27017"
    }
  ]
}

> rs.initiate(cfg)
{"ok": 1}

It’s puzzling that the error message you’re seeing seems to contradict the setup that you did, and which I confirmed are correct. If this issue is still relevant, could you please add more details:

  • What is your MongoDB and your OS version?
  • How did you install MongoDB?
  • Could you please double-check that all IP addresses and port numbers you used are correct?
  • Do you have more than one mongod running by accident, e.g. you may have another mongod running that was installed and run as a service. In a Linux system, you can check the output of ps aux | grep mongod. In Windows, you can check the Task Manager.

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages