"errmsg" : "server is not running with --replSet"

mongodb

Solution

I had the same problem. Thanks to this question and previous answers I solved doing:

- I checked all the running mongod processes `ps -ef | grep mongo`. I had 1 mongo and 2 mongod processes

- I killed mongod with sudo `sudo killall mongod`

- and at the end I started with sudo `sudo mongod --port 27017 --dbpath \srv\mongodb\rs0-0 --replSet rs0 --smallfiles --oplogSize` and it worked

Problem

i am creating replica set on my local system in windows environment by following step ``` mkdir -p \srv\mongodb\rs0-0 \srv\mongodb\rs0-1 \srv\mongodb\rs0-2 mongod --port 27017 --dbpath \srv\mongodb\rs0-0 --replSet rs0 --smallfiles --oplogSize 128 mongod --port 27018 --dbpath \srv\mongodb\rs0-1 --replSet rs0 --smallfiles --oplogSize 128 mongod --port 27019 --dbpath \srv\mongodb\rs0-2 --replSet rs0 --smallfiles --oplogSize 128 ``` and then ``` mongo shell type mongo --port 27017 rs.initiate() ``` but i am getttin error ``` "{ "ok" : 0, "errmsg" : "server is not running with --replSet" }" ``` thanks in advance

Original source