About MongoDB Atlas cluster hostnames.
MongoDB Atlas clusters are deployed either as a replica set or a sharded cluster.
Upon cluster deployment a unique domain name is allocated to each server of the Atlas cluster called the hostname.
Cluster hostnames can be resolved to a public IP address with the nslookup command. For example:
nslookup cluster0-shard-00-00.qndfy.net
Address 3.211.244.149
The servers of an Atlas cluster are either primary or secondary nodes and have host type P, S or "i" depending on the role of the server:
P for primary node
S for secondary node
“i” for for NVMe hidden secondary nodes
Note: Atlas clusters must have a minimum of three servers and do not permit Replica Set Arbiters.
How can I find my clusters' hostnames?
For All Atlas clusters:
Atlas displays metrics for all cluster servers, databases, and MongoDB processes which can be used to identify performance issues and determine whether your current cluster tier meets your requirements.
Use the View Monitoring tab on your Atlas clusters to find the unique hostnames of your Replica set or Sharded clusters:
For Replica Set clusters:
MongoDB Atlas clusters are deployed as a three node replica set, one primary node and two secondary nodes, by default to ensure the high availability of your data.
Additional nodes can be added to your cluster for high availability and workload isolation.
Atlas replica set clusters are deployed on port 27017.
A replica sets METRICS tab displays the cluster’s unique hostname, port number and node type:
Note: The number of servers that Atlas displays on the Metrics page at any given time depends on the browser screen size. Use the Toggle Members section to control which servers Atlas displays. Hover over the S and P icons to find out which servers they represent.
For Sharded clusters:
Sharding is a method for distributing data across multiple machines, used for supporting deployments with very large data sets and high throughput operations.
Sharded clusters support horizontal scaling and consist of
shards deployed as a replica set
config servers for meta data and configuration settings
mongos acting as query routers
The mongos query router uses port 27016 to communicate with the sharded cluster
A sharded cluster's Metrics tab lists the shards of the sharded cluster:
Clicking on the MONGOS tab brings you to the cluster’s individual hostnames and with the mongos query router on port 27016:
Note: While the individual servers of your shards and config servers of your sharded cluster reside on port 27017, client applications can only route queries through the mongos query router via port 27016.
Can I find my hostnames programatically?
Yes, the following Atlas API Resources can be used to retrieve the hostnames of your Atlas cluster(s) programatically:
Please see also the MongoDB Configure Atlas API Access documentation.