Docs Menu

Get Started with MongoDB Cloud Manager

On this page

  • Prerequisites
  • Create a Cluster
  • Retrieve the Cluster
  • Watch Your Automation Configuration Status
  • Summary

MongoDB CLI provides a command-line interface for managing your MongoDB Cloud Manager projects and clusters.

This tutorial demonstrates how to:

  • Create clusters in your Cloud Manager project
  • Retrieve details about the new cluster

The reference pages for the commands mentioned in this tutorial are available in the Reference section.

Before you begin, you must complete the following:

Use the mongocli cloud-manager clusters create command to create a cluster in Cloud Manager.

The following command creates a sample cluster with the following settings:

  • Cluster name: getStarted
  • MongoDB server version: 5.0.0
  • Feature compatibility version: 5.0
  • Replica set members: 3
  • Member hostnames: host1, host2, host3

    Note

    This tutorial uses the hostnames host1, host2, and host3. Replace these hostnames with valid MongoDB server hostnames.

  • Data directories for each mongod instance: /data/cluster/rs1, /data/cluster/rs2, /data/cluster/rs3
  • Log file path for each mongod instance: /data/cluster/rs1/mongodb.log, /data/cluster/rs2/mongodb.log, /data/cluster/rs3/mongodb.log
  • Port for each mongod process: 29010, 29020, 29030
  • Voting priority for each member: 1
  • Number of votes for each member: 1
1

To learn more about the configuration file properties, see Cluster Configuration File.

{
"name": "getStarted",
"version": "5.0.0",
"featureCompatibilityVersion": "5.0",
"processes": [
{
"hostname": "host1",
"dbPath": "/data/cluster/rs1",
"logPath": "/data/cluster/rs1/mongodb.log",
"priority": 1,
"votes": 1,
"port": 29010
},
{
"hostname": "host2",
"dbPath": "/data/cluster/rs2",
"logPath": "/data/cluster/rs2/mongodb.log",
"priority": 1,
"votes": 1,
"port": 29020
},
{
"hostname": "host3",
"dbPath": "/data/cluster/rs3",
"logPath": "/data/cluster/rs3/mongodb.log",
"priority": 1,
"votes": 1,
"port": 29030
}
]
}
2
mongocli cloud-manager cluster create --file getStartedCluster.json

You can check whether your cluster was successfully created by retrieving the cluster details using the mongocli cloud-manager clusters describe command.

mongocli cloud-manager cluster describe getStarted

Your command output should look similar to the following:

{
"mongoURI": "mongodb://host1:29010,host2:29020,host3:29030",
"name": "getStarted",
"processes": [
{
"buildIndexes": true,
"db_path": "/data/cluster/rs1",
"featureCompatibilityVersion": "5.0",
"hostname": "host1",
"log_path": "/data/cluster/rs1/mongodb.log",
"name": "getStartedCluster",
"port": 29010,
"priority": 1,
"process_type": "mongod",
"slave_delay": 0,
"version": "5.0.0",
"votes": 1,
"arbiter_only": false,
"disabled": false,
"hidden": false
},
{
"buildIndexes": true,
"db_path": "/data/cluster/rs2",
"featureCompatibilityVersion": "5.0",
"hostname": "host2",
"log_path": "/data/cluster/rs2/mongodb.log",
"name": "getStartedCluster",
"port": 29020,
"priority": 1,
"process_type": "mongod",
"slave_delay": 0,
"version": "5.0.0",
"votes": 1,
"arbiter_only": false,
"disabled": false,
"hidden": false
},
{
"buildIndexes": true,
"db_path": "/data/cluster/rs3",
"featureCompatibilityVersion": "5.0",
"hostname": "host3",
"log_path": "/data/cluster/rs3/mongodb.log",
"name": "getStartedCluster",
"port": 29030,
"priority": 1,
"process_type": "mongod",
"slave_delay": 0,
"version": "5.0.0",
"votes": 1,
"arbiter_only": false,
"disabled": false,
"hidden": false
}
]
}

Run the mongocli cloud-manager automation watch command to determine if the cluster is ready for use. The following command uses the default profile to access the Cloud Manager project:

mongocli cm automation watch

Congratulations! You have successfully created a cluster to host your data. You can connect to your cluster using the connection string for mongosh or your application or view your cluster by logging in to the UI.

Give Feedback
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.