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: