Navigation
This version of the documentation is archived and no longer supported. 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.

Clusters

MongoDB supports two different kinds of clusters: replica sets and sharded clusters. Since a shard within a sharded cluster is typically a replica set, a sharded cluster is a cluster of clusters. This relationship is 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.

Operations

  • GET /api/public/v1.0/groups/GROUP-ID/clusters/CLUSTER-ID - Get a single cluster by ID.
  • GET /api/public/v1.0/groups/GROUP-ID/clusters - Get all clusters in a group. Note that if Ops Manager hasn’t received a ping from a cluster in several days, it will be considered inactive and will be filtered from this list. 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.
  • PATCH /api/public/v1.0/groups/GROUP-ID/clusters/CLUSTER-ID - Update a cluster by ID. The only property that you may modify is the clusterName, since all other properties of a cluster are discovered by Ops Manager. Additionally, this operation is only permitted on clusters of type SHARDED and SHARDED_REPLICA_SET.

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 ID of the group that owns this cluster.
typeName enum

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

  • MASTER_SLAVE
  • REPLICA_SET
  • SHARDED
  • SHARDED_REPLICA_SET
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.
lastHeartbeat date The approximate last time Ops Manager processed a ping from this cluster.

Examples

Get a Cluster

curl -u "username:apiKey" --digest -i "https://mms.mongodb.com/api/public/v1.0/groups/533c5895b91030606f21033a/clusters/533d7d4730040be257defe88"

HTTP/1.1 200 OK

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

Get all Clusters

curl -u "username:apiKey" --digest -i "https://mms.mongodb.com/api/public/v1.0/groups/533c5895b91030606f21033a/clusters"

HTTP/1.1 200 OK

{
  "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

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

HTTP/1.1 200 OK

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