How to deploy three config server instances for sharding in mongodb?

506 views Asked by At

I am a newbie in MongoDB. Also I have not much knowledge in networking and servers. I am trying to deploy sharded cluster in mongodb using this article.

It says I need to deploy three configuration server instances and create data directories for each.
I can create a data directory using this command

mkdir /data/configdb

But how do I do this for all three of them?
Also I want to do this in only one machine.

1

There are 1 answers

0
bagrat On BEST ANSWER

As dev mentioned, for testing purposes a single config server is pretty much enough, and three config servers should be considered for production deployment.

But anyway, there is no problem creating separate directories for each config server on one machine. As you have mentioned, yes you can create directories, but data directory for any mongo instance (mongod, configsvr, etc.) is not limited to any path. So that means you can create separate directories and launch mongod config servers by specifying path for each:

$ mkdir /data/configdb1
$ mkdir /data/configdb2
$ mkdir /data/configdb3
$ mongod --configsvr --dbpath /data/configdb1 ...
$ mongod --configsvr --dbpath /data/configdb2 ...
$ mongod --configsvr --dbpath /data/configdb3 ...