Multiple Mongos on one server

mongodb

I'm not talking about sharding. We had a testing server (linux) and there is already one mongo which belongs to another project/subteam. Is it possible to run multiple, isolated instances of mongodb on one machine? How can I do it?

Best Answer

Yes, you can do this by specifying different port numbers and data directories for the other instances of mongod, and then specifying the new port number in the client.

For example:

./mongod --dbpath /foo/bar/otherpath --port some_other_port

You can also change the shard server and config server port numbers if you need to.