When deploying a replica set or a sharded cluster (any situation with several mongod's really) – how does one know what port numbers to use?
Up until now I have used all the port no's I've found in examples and tutorials, but there doesnt seem to be any obvious system or way to go about it.
For example, one example uses ports 27010 – 27014. Another example uses 27001-27003, 27020-22, 26050 etc.
The only information I found on the docs of mongodb, was the one of the default ports.
As a student (so not production deployment) who is just using a single machine, what should I use? The default ones are only 4 and I probably need atleast 8 mongod's running (for a small sharded cluster with replica sets).
Can more than 1 shardserver be using the same port?
(I am sure this is a naive question as this has not been asked about other places nor addressed in any of the mongodb books I have found, but I want to know.)
Thankful in advance.
Best Answer
You can use any ports you like. Particularly on a toy system, it makes no practical difference what number port you choose; it works just as well with port 29589 as port 27017.
Some things to keep in mind: