Mongodb, sharding and multiple windows services

Viewed 5188

In order to get sharding to work I need to run two copies of mongod.exe. One as a shard and one as the config server. How can I install both mongod instances as windows services?

4 Answers

create a new config file with different port, db location, etc.. and save as mongod2.cfg

mongod --install --serviceName 'Mongo DB 2nd instance' --serviceDisplayName 'Mongo DB 2nd instance' -f 'C:\Program Files\MongoDB\Server\4.4\bin\mongod2.cfg'

need to use full path to the new config file

this will install as service and you can edit all configurations, like the main instance

Related