Navigation
This version of the documentation is archived and no longer supported. It will be removed on EOL_DATE. To learn how to upgrade your version of MongoDB Ops Manager, refer to the upgrade documentation.
You were redirected from a different version of the documentation. Click here to go back.
This version of the manual is no longer supported. It will be removed on EOL_DATE.

Clusters

Note

Groups and projects are synonymous terms. Your {GROUP-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.

Overview

MongoDB supports two types of clusters: replica sets and sharded clusters. A sharded cluster can contain replica sets within it: each shard can be a replica set and the config server can also be a replica set. These relationships are reflected in the way Ops Manager models clusters, and it might lead to unexpected results from the Clusters resource. As an example, consider a deployment with one sharded cluster containing four shards, and each shard is a three-node replica set. In this scenario, the Clusters resource will return five entities: one that represents the sharded cluster, and four to represent the replica sets (shards). However, if each shard in this fictitious deployment was a standalone mongod instead of a replica set, then the Clusters resource would only return one entity representing the sharded cluster.

Endpoints

Get All Clusters

Get all clusters in a group.

GET /groups/GROUP-ID/clusters

Use the parentClusterId query parameter to get all clusters with the specified parent cluster ID. The list of entities is sorted in ascending order by the date that Ops Manager discovered the cluster.

Get a Cluster

Get a single cluster by ID.

GET /groups/GROUP-ID/clusters/CLUSTER-ID

Update a Cluster

Update a cluster by ID. The only property that you may modify is the clusterName, since Ops Manager discovers all other cluster properties. This operation is only available on clusters of type SHARDED and SHARDED_REPLICA_SET.

PATCH /groups/GROUP-ID/clusters/CLUSTER-ID

Sample Entity

{
  "id": "yyy",
  "groupId": "xxx",
  "typeName": "REPLICA_SET",
  "clusterName": "Cluster 0",
  "shardName": "shard001",
  "replicaSetName": "rs1",
  "lastHeartbeat": "2014-02-26T17:32:45Z",
  "links" : []
}

Entity Fields

Name Type Description
id string Unique identifier.
groupId string Unique identifier of the group that owns this cluster.
typeName string

Specifies what kind of cluster this is. Possible values are:

  • REPLICA_SET
  • SHARDED: a sharded cluster where each shard is a standalone instance. No shards are replica sets.
  • SHARDED_REPLICA_SET: a sharded cluster that contains at least one shard that is a replica set.
  • CONFIG_SERVER_REPLICA_SET: config servers deployed as a replica set.
  • MASTER_SLAVE
clusterName string Display name of the cluster. Only applies to sharded clusters. Note that mongod itself doesn’t allow you to name a cluster; this name is supplied by (and editable within) Ops Manager. For a replica set within a sharded cluster, the cluster name is the name of its parent cluster.
shardName string Name of the shard. Only present for a cluster of type SHARDED or REPLICA_SET that is part of a sharded cluster.
replicaSetName string Name of the replica set. Only present for a cluster of type REPLICA_SET or CONFIG_SERVER_REPLICA_SET.
lastHeartbeat date The approximate last time Ops Manager processed a ping from this cluster.

Examples

Get a Cluster

Request

curl --user "{username}:{apiKey}" --digest \
 --header "Accept: application/json" \
 --include \
 --request GET "https://<ops-manager-host>/api/public/v1.0/groups/533c5895b91030606f21033a/clusters/533d7d4730040be257defe88"

Response

Response Header

HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}

Response Body

{
  "id" : "533d7d4730040be257defe88",
  "typeName" : "SHARDED_REPLICA_SET",
  "clusterName" : "Animals",
  "lastHeartbeat" : "2014-04-03T15:26:58Z",
  "links" : []
}

Get all Clusters

Request

curl --user "{username}:{apiKey}" --digest \
 --header "Accept: application/json" \
 --include \
 --request GET "https://<ops-manager-host>/api/public/v1.0/groups/533c5895b91030606f21033a/clusters"

Response

Response Header

HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}

Response Body

{
  "totalCount" : 3,
  "results" : [ {
    "id" : "533d7d4730040be257defe88",
    "typeName" : "SHARDED_REPLICA_SET",
    "clusterName" : "Animals",
    "lastHeartbeat" : "2014-04-03T15:26:58Z",
    "links" : []
  }, {
    "id" : "533d7d4630040be257defe85",
    "typeName" : "REPLICA_SET",
    "clusterName" : "Animals",
    "shardName" : "cats",
    "replicaSetName" : "cats",
    "lastHeartbeat" : "2014-04-03T15:24:54Z",
    "links" : []
  }, {
    "id" : "533d7d4630040be257defe83",
    "typeName" : "REPLICA_SET",
    "clusterName" : "Animals",
    "shardName" : "dogs",
    "replicaSetName" : "dogs",
    "lastHeartbeat" : "2014-04-03T15:26:30Z",
    "links" : []
  } ],
  "links" : []
}

Update a Cluster

Request

curl -u "username:apiKey" -H "Content-Type: application/json" --digest -i -X PATCH "https://<ops-manager-host>/api/public/v1.0/groups/533c5895b91030606f21033a/clusters/533d7d4730040be257defe88" --data '
{
  "clusterName": "Zoo"
}'

Response

Response Header

HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}

Response Body

{
  "id" : "533d7d4730040be257defe88",
  "typeName" : "SHARDED_REPLICA_SET",
  "clusterName" : "Zoo",
  "lastHeartbeat" : "2014-04-03T15:26:58Z",
  "links" : []
}