Static IP MongoDB


I know this isn’t probably where this should be but I really need help.

I am using Node.JS
I am running a local server
I am connecting to MongoDB shared Cluster
I want to have a static Ip for when connecting to the cluster
The static Ip will be used on my network to allow my server to connect to the cluster without opening every ip and port.

if you have any information on how to get a static ip that will never change for a mongodb cluster please let me know.

Hi @Reece_Barker welcome to the community!

Do you mean you want to have static IP for you local server so you don’t have to open the database server to all IPs?

In general terms, since MongoDB strongly recommends the use of replica sets for production deployment, using static IPs for the databases will make things harder in the long run. Static IPs will make maintenance harder, and will undermine the high-availability functionality of a replica set. This is mentioned in the Operations Checklist:

Use hostnames when configuring replica set members, rather than IP addresses

However if your goal is to have a static IP for your app, this depends on your internet service provider. Many providers allow you to have static IPs at additional cost.

Having said that, these networking concerns are one layer below the services provided by the app and MongoDB. Both will just connect to/from any network interface you deploy them on.

Best regards