1

We're using a MongoDB replica on Windows using default ports (27017).

Our servers are all behind firewalls and we want to configure the firewall to only allow the default port open.

However, when looking at netstat, we see the following ports used:

[mongod.exe]
  TCP    0.0.0.0:27017          SERVER-NAME:0           LISTENING
[mongod.exe]
  TCP    0.0.0.0:47001          SERVER-NAME:0           LISTENING

Why is mongo suing the dynamic port 47001? we had to open the dynamic port on the firewall (in addition to the default 27017) to allow other servers to access it.

Why does mongo need the dynamic port? can I at least force it to use a preconfigured port?

Thanks!

  • Are these servers a replica-set and/or a shared cluster? – Philipp Jul 15 '15 at 8:04
  • only replica-set, however they also host the actual application which does queries and updates. – user4537 Jul 15 '15 at 8:38
0

Seeing as how we can see that the default port is being used for the mongo instances, the port has to come from either the shardsvr or configsvr runtimes.

Judging by the comments...
Your best bet is to check if the ports are being used by the replica set.

db.runCommand( { replSetGetStatus : 1 } )

The port used should show up in the name part of the output document.

  • The name is SERVER-NAME:defaultport, and doesn't have any information on the dynamic port used. – user4537 Jul 15 '15 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.