Docs Home → MongoDB Atlas
Atlas does not guarantee that host names remain consistent with respect to node types during topology changes.
Example
If you have a cluster named foo123
containing an analytics node foo123-shard-00-03-a1b2c.mongodb.net:27017
, Atlas does not
guarantee that specific host name will continue to refer to an analytics node after a topology change, such as scaling a cluster to modify its number of nodes or regions.
To access a database deployment, you must connect from an IP address on the Atlas project's IP access list. If you need to add an IP address to the IP access list, you can do so in the Connect dialog. You can also add the IP address from the Network Access tab.
To access a database deployment, you must create a database user with access to the desired database[s] on your Atlas database deployment. Database users are separate from Atlas users. Database users have access to MongoDB databases, while Atlas users have access to the Atlas application itself.
You can create a database user to access your Atlas database deployment in the Connect dialog. You can also add the database user from the Database Deployment view.
Make sure your application can reach your MongoDB Atlas environment. To add the inbound network access from your application environment to Atlas, do one of the following:
Add the public IP addresses to your IP access list
Use VPC / VNet peering to add private IP addresses.
Add private endpoints.
Tip
See also:
If your firewall blocks outbound network connections, you must also open outbound access from your application environment to Atlas. You must configure your firewall to allow your applications to make outbound connections to ports 27015 to 27017 to TCP traffic on Atlas hosts. This grants your applications access to databases stored on Atlas.
Note
By default, MongoDB Atlas clusters do not need to be able to initiate connections to your application environments. If you wish to enable Atlas clusters with LDAP authentication and authorization, you must allow network access from Atlas clusters directly to your secure LDAP. You can allow access to your LDAP by using public or private IPs as long as a public DNS hostname points to an IP that the Atlas clusters can access.
If you are not using VPC / VNet peering and plan to connect to Atlas using public IP addresses, see the following pages for additional information:
Can I specify my own VPC for my MongoDB Atlas project?
Do Atlas clusters' public IPs ever change?
Note
If you are experiencing issues connecting to your database deployment, see Troubleshoot Connection Issues.
Tip
See also:
Connect via Your Application
Connect via Compass
Connect via
mongosh
Connect via BI Connector for Atlas
Browse Data via the Atlas UI
Test Failover
Manage Connections with AWS Lambda
Connection Limits and Cluster Tier
Navigation
You were redirected from a different version of the documentation. Click here to go back.
- API >
- Cloud Manager Administration API Resources >
- Deployments >
- Hosts >
- Get One Host by Hostname and Port
Note
Groups and projects are synonymous terms. Your {PROJECT-ID}
is the same as your project id. For existing groups, your group/project id remains the same. This page uses the more familiar term group when referring to descriptions. The endpoint remains as stated in the document.
Get a single MongoDB process by its hostname and port combination. You can specify either the primary hostname or an alias.
Base URL: //cloud.mongodb.com/api/public/v1.0
Resource¶
GET /groups/{PROJECT-ID}/hosts/byName/{HOSTNAME}:{PORT}
Request Path Parameters¶
string | Required | Unique identifier of the project that owns this MongoDB process. |
string | Required | Primary hostname Cloud Manager should use to connect to this MongoDB instance. This hostname can be a hostname, an FQDN, an IPv4 address, or an IPv6 address. |
string | Required | Port on which the MongoDB process listens. |
Request Query Parameters¶
The following query parameters are optional:
boolean | Optional | Flag indicating whether the response body should be in a prettyprint format. | false
| ||
boolean | Optional | Flag that indicates whether or not to wrap the response in an envelope. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. For endpoints that return one result, the response body includes:
| false
|
Request Body Parameters¶
This endpoint doesn’t use HTTP request body parameters.
Response¶
array of strings | Array of alternate hostname and port combinations that Cloud Manager discovered for the MongoDB process. These combinations can include hostnames, FQDNs, IPv4 addresses, and IPv6 addresses. |
boolean | true if this MongoDB process has alerts enabled.
|
string | Authentication mechanism used to connect to this MongoDB process. This displays only one of the following values:
|
string | Unique identifier of the cluster to which the MongoDB process belongs. |
date | Date Cloud Manager created or first discovered this MongoDB process. |
string | Unique identifier of the group that owns this host. |
boolean | true if this MongoDB process had startup warnings.
|
boolean | true if host is displayed in the Cloud Manager UI. Hosts set to true are omitted from API responses.
|
boolean | true if this host is a hidden secondary.
|
boolean | true if the MongoDB process currently enabled.
|
string | Primary hostname as Cloud Manager can best determine. This can be a hostname, an FQDN, an IPv4 address, or an IPv6 address. |
string | Unique identifier. |
string | IPv4 or IPv6 address associated with the hostname of this MongoDB process. Additional accessible IPv4 or IPv6 addresses may be displayed in the aliases array.
|
boolean | true if journaling is enabled for this MongoDB process.
|
number | Uncompressed size of the host’s databases on disk in bytes excluding indexes. lastDataSizeBytes does not include the data in the local database.
|
number | Uncompressed size of the host’s database indexes on disk in bytes. This number does not include the size of the index for the local database. |
date | Timestamp in ISO 8601 date and time format in UTC when the last ping for this MongoDB process was received. |
date | Timestamp in ISO 8601 date and time format in UTC when this process last restarted. If the MongoDB process has never been restarted, the lastRestart field is omitted.
|
array | Array that includes one or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification. At minimum, a links array contains one link called self .
|
boolean | true if Cloud Manager is collecting logs for this MongoDB
process.
|
boolean | true if this MongoDB process’s host has a low ulimit
setting.
|
number | Port on which the MongoDB process listens. |
boolean | true if Cloud Manager collects profile information from this MongoDB process.
|
string | Name of the replica set this process belongs to. Only present if this process is part of a replica set. |
string | Current state of this MongoDB process within a replica set. Only present if this process is part of a replica set. See Replica Set Member States for possible values. |
string | Name of the shard to which this process belongs. Only present if the process is part of a sharded cluster. |
number | Number of seconds this replica set member’s data trails the primary. If this value is set to 0 , the member is not configured as a delayed member. For additional details on slave delays, see
Delayed Replica Set Members
|
boolean | true if TLS/SSL and is enabled for this MongoDB
process.
|
object | Object that contains RAM and CPU information for this MongoDB process’ server as reported by the operating system or container. |
number | Amount of RAM in megabytes. |
number | Number of CPU cores. |
string | Type for this MongoDB process. Possible values are:
The type for new hosts added to Cloud Manager will be |
number | Number of milliseconds since this process last restarted. |
string | Version of MongoDB running for this process. |
Example Request¶
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --include \ --request GET "//cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/hosts/byName/server1.example.com:27017?pretty=true"
Example Response¶
Response Body¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | { "alertsEnabled" : true, "aliases": [ "server1.example.com:27017", "10.1.0.10:27017" ], "authMechanismName" : "SCRAM-SHA-1", "clusterId" : "{CLUSTER-ID}", "created" : "2014-04-22T19:56:50Z", "groupId" : "{PROJECT-ID}", "hasStartupWarnings" : false, "hidden" : false, "hostEnabled" : true, "hostname" : "server1.example.com", "id" : "{HOST-ID}", "ipAddress": "10.1.0.10", "journalingEnabled" : false, "lastDataSizeBytes" : 633208918, "lastIndexSizeBytes" : 101420524, "lastPing" : "2016-08-18T11:23:41Z", "links" : [ ], "logsEnabled" : false, "lowUlimit" : false, "muninEnabled" : false, "port" : 27017, "profilerEnabled" : false, "replicaSetName": "rs1", "replicaStateName" : "PRIMARY", "sslEnabled" : true, "systemInfo" : { "memSizeMB" : 65536, "numCores" : 16 }, "typeName": "REPLICA_PRIMARY", "uptimeMsec": 1827300394, "username" : "mongodb", "version" : "4.0.0" } |
Note
Although Cloud Manager returns muninEnabled in the response, Munin is unsupported.