Hello Developers, i asked a host provider about how to deploy my node.js/MongDB app, where my MongoDB is hosted on Atlas. They answered that they want to know the IP and Port of external MongoDB server in order to whitelist outgoing firewall exceptions at their firewall. How can i find the IP and Port of my Database hosted in Mongo Atlas? Thanks
How can i find the IP and Port of my Database hosted in Mongo Atlas?
Regarding the ports, you may find the Troubleshoot Connection Issues documentation useful, more specifically the following:
Atlas clusters operate on port
27017 . You must be able to reach this port to connect to your clusters. Additionally, ensure that the appropriate ports are open for the following:
- For sharded clusters, grant access to port 27016.
- For BI Connector, grant access to port 27015.
In regards to finding the IP for each of the nodes in your Atlas cluster, you can perform a simple
ping hostname. To find the hostnames of each node within your cluster, you can click the metrics button on the cluster as shown in the below example:
After clicking the metrics button, the hostname:port should be in a similar format to the below example:
(Where cluster0-shard-00-00.abcde.mongodb.net is the hostname)
They answered that they want to know the IP and Port of external MongoDB server in order to whitelist outgoing firewall exceptions at their firewall.
I must note that there are cases where the public IP’s can change. For this reason, it may be better that they whitelist the hostname rather than the IP address.
Hope this helps.
Thank you. In my Cluster0 i have 3 shards 00-00, 00-01 and 00-02 the first two are secondary and the last is the primary, so its better to send to the host all three shards?
Technically they are tree nodes of the same shard. But terminology aside you will need to be ale to connect to every node in the cluster.
If a host fails or, more likely a rolling upgrade the primary role will transition to another one of the nodes, and you will need to be able to connect to it.
So send only one shard hostname or all of them?
Every node in the cluster means all of them.
Nice. Some last curious question… This hostname is unique for every user or this represents a shared host where multiple users have hosted their clusters?
For shared tier instances (M0, M2 and M5) which exist on a shared environment, the hostname(s) in your cluster are unique but would trace back to the same IP as the shared host machine.
For dedicated tier instances (M10+), the hostname(s) for each node and the associated public IP’s would be unique.
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.