0

I have a test environment running on Windows 10 as follows :

  • A replica set "rs0" with 3 nodes : MONGO2, MONGO3, MONGOARB1 each running on port 27017.
  • A config server in a replicaSet "rs1" : MONGOCONFIGSERVER1 running on port 27019.

Now I'd like to add a mongos server as describe here

  • I am stopping the mongodb instance.
  • Promote the server ./mongos.exe --configdb rs1/MONGOCONFIGSERVER1:27019 --bind_ip_all
  • Open a new window, connect to mongo.
  • Add shards sh.addShard( "rs0/MONGO2:27017,MONGO3:27017,MONGOARB1:27017" )

Everything works great but how am I supposed to keep this configuration permanently ? Once I close my terminales everything is back in the state it was originally.

and if I try to modify my mongod.cfg file with:

#sharding:
sharding:
  configdb: rs1/MONGOCONFIGSERVER1:27019

The service won't start anymore:

enter image description here

1
  • To have a working cluster, you must run (data) replica set AND (config) replica set same time. Then you start mongoS (you can start it on one of the config RS nodes) and point it to (running) config RS. So, information of cluster is stored in config RS and all connections (to data RS) goes thru config RS.
    – JJussi
    Jan 27 at 12:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.