Navigation

mongocli cloud-manager cluster list

On this page

The cluster list command retrieves all the clusters in the specified MongoDB Cloud Manager project. You can also retrieve all the clusters in a project through the Cloud Manager UI or API.

If you do not specify a project, the command returns all clusters in all projects. You can also retrieve all clusters in all projects through the Cloud Manager API.

Syntax

mongocli cloud-manager|cm cluster list
     [ --output|-o <output-format> ]
     [ --profile|-P <profile-name> ]
     [ --projectId projectId ]

Note

Use -h or --help to view the command-line help for this command.

Options

Option Type Description Required?
--output, -o string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using Go template file

If omitted, the command returns output in the default format.

no
--profile, -P string Name of the profile where the public and private keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI. no
--projectId string Unique identifier of the project that contains the cluster to update. If omitted, uses the project ID in the profile or the environment variable. If no project ID is specified in the profile or environment variable, then the command returns all clusters in all projects. no

Output

The command prints the following fields in the specified format to the terminal if the command succeeds. If the command returns errors, see Troubleshooting for recommended solutions.

Field Description
mongoURI The connection string used to access the Ops Manager Application Database.
name Name of the cluster.
processes Configuration information for mongod processes on the cluster.
processes.arbiterOnly

Flag that indicates whether or not the replica set member is an arbiter node. Value can be:

  • true if the member is an arbiter node
  • false if the member is a non-arbiter node
processes.buildIndexes Flag that indicates whether to direct mongod to build indexes. This setting corresponds to the buildIndexes mongod replica set configuration option.
processes.dbPath The location and name of the MongoDB log files.
processes.disabled

Flag that indicates whether or not the process is disabled. Value can be:

  • true if disabled
  • false if enabled
processes.featureCompatibilityVersion The Feature Compatibility Version of the deployment.
processes.hidden

Flag that indicates whether or not the replica set member is hidden. Value can be:

  • true if the member is hidden
  • false if the member is not hidden
processes.hostname The hostname of the replica set member.
processes.logPath The full path to the mongod log file, including the log file name and extension.
processes.name Hostname and port of the mongod process.
processes.port The IANA port number for the mongod process.
processes.priority The priority of the member during elections.
processes.processType Type of process. Value will be mongod.
processes.slaveDelay Number of seconds behind the primary that the replica set member should lag.
processes.version The MongoDB server version of the mongod process.
processes.votes Number of votes that the replica set member has during elections.

Examples

The following examples show two ways to run the command.

Example 1

The following mongocli cloud-manager clusters list command returns the clusters in the specified project in the specified format. It uses the default profile to access the specified project.

mongocli cloud-manager clusters list --output json --projectId 5e2f06127a3e5a5700de8d8d

Example 2

The following mongocli cm clusters list command returns the clusters in the specified project in the specified format. It uses the profile named egCMprofile to access the specified project.

mongocli cm clusters list --output json --projectId 5e2f06127a3e5a5700de8d8d --profile egCMprofile

Output

The Example 1 and Example 2 commands print the following fields to the terminal. To learn more about these fields, see Output.

[
     {
             "mongoURI": "mongodb://host0:29010,host1:29020,host2:29030",
             "name": "myCluster",
             "processes": [
                     {
                             "buildIndexes": true,
                             "dbPath": "/data/cluster_2/rs1",
                             "featureCompatibilityVersion": "4.2",
                             "hostname": "host0",
                             "logPath": "/data/cluster_2/rs1/mongodb.log",
                             "name": "myCluster_0",
                             "port": 29010,
                             "priority": 1,
                             "processType": "mongod",
                             "slaveDelay": 0,
                             "version": "4.2.3",
                             "votes": 1,
                             "arbiterOnly": false,
                             "disabled": false,
                             "hidden": false
                     },
                     {
                             "buildIndexes": true,
                             "dbPath": "/data/cluster_2/rs2",
                             "featureCompatibilityVersion": "4.2",
                             "hostname": "host1",
                             "logPath": "/data/cluster_2/rs2/mongodb.log",
                             "name": "myCluster_1",
                             "port": 29020,
                             "priority": 1,
                             "processType": "mongod",
                             "slaveDelay": 0,
                             "version": "4.2.3",
                             "votes": 1,
                             "arbiterOnly": false,
                             "disabled": false,
                             "hidden": false
                     },
                     {
                             "buildIndexes": true,
                             "dbPath": "/data/cluster_2/rs3",
                             "featureCompatibilityVersion": "4.2",
                             "hostname": "host2",
                             "logPath": "/data/cluster_2/rs3/mongodb.log",
                             "name": "myCluster_2",
                             "port": 29030,
                             "priority": 1,
                             "processType": "mongod",
                             "slaveDelay": 0,
                             "version": "4.2.3",
                             "votes": 1,
                             "arbiterOnly": false,
                             "disabled": false,
                             "hidden": false
                     }
             ]
     }
]