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
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:
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