"errmsg": "server does not work with --replSet"

I create a replica set on my local system in a Windows environment with the next 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 get getttin message

"{ "ok" : 0, "errmsg" : "server is not running with --replSet" }"

early

+4
source share
1 answer

I had the same problem. Thanks to this question and previous answers, I decided:

  • I checked all running mongod processes ps -ef | grep mongo. I had 1 mongo process and 2 mongod.
  • I killed mongod with sudo sudo killall mongod
  • and in the end I started with sudo sudo mongod --port 27017 --dbpath \srv\mongodb\rs0-0 --replSet rs0 --smallfiles --oplogSizeand it worked
+3
source

Source: https://habr.com/ru/post/1547033/


All Articles