Skip to content

Replica Sets

Luke Lovett edited this page Oct 16, 2014 · 18 revisions

##/replica_sets

ReplicaSet collection

Methods:

  • POST - create and get up new ReplicaSet

    Example:

{
  "preset": "basic.json", // [optional] - configuration file on server, e.g., configurations/rs/basic.json
  "version": "26-release", // [optional] - release to use, as defined in configuration file
  "id": "default",  // [optional] replica set name
  "auth_key": "secret phrase",   // [optional]  - authentication key
  "login": "admin", // [optional] - username for the admin collection
  "password": "adminpass", // [optional] - password
  "timeout": 300,  // [optional] - (default: 300), specify how long, in seconds, a command can take before server times out.
  "sslParams": { "sslCAFile" : "~/ca.pem" }, // [optional] - SSL options http://docs.mongodb.org/manual/administration/ssl/
  "members": // list of member config
     [ {"rsParams": {"hidden":true, "priority":0}, "procParams": {"port":3333, "smallfiles": true}},
       {"rsParams":{"arbiterOnly":true}, "procParams": {"port": 3334}},
       {"sslParams": { "sslCAFile" : "~/ca.pem" }}, // use default parameters with SSL
       {}  // use default parameters
     ]
}

If preset is specified, parameters are first loaded from the server-side configuration file, e.g., configurations/rs/basic.json, and then updated with any other supplied parameters. The update is a deep merge so that individual leaf values can be overridden by supplied parameters.

Minimal example:

{
  "preset": "basic.json", // [optional] - configuration file on server, e.g., configurations/rs/basic.json
}

In this minimal example, all parameters are supplied from the server-side configuration file. If id is not specified in the configuration file, a uuid is generated for the id.

The version field allows you to specify what release defined in the --config file to use when starting the Server. The config file must be provided to server.py on startup, and only releases defined within the file are valid to use. If this field is omitted, then Mongo Orchestration will choose the first release in the config file. If no config file was given, then Mongo Orchestration will start whatever binary is on the user's PATH. See also: /releases.

mongo-orchestration uses specific values for members parameters for best performance:

{"noprealloc": true, "nojournal": true, "smallfiles": true, "oplogSize": 10}

Each of members has two type of parameters:

The response body is very similar to a GET to /replica_sets/{repl-id}.

 + 500 - Returned if create replica set was fail

##/replica_sets/{repl-id} Parameters:

  • repl id - string contains the replica set id

Methods:

  • POST - Issue a command to the ReplicaSet.

The request body is of the form {"action": "<COMMAND NAME>"}.

Currently available commands are as follows:

  • reset - Ensure all members of the ReplicaSet are available, starting any that are not.

  • PUT - Create a new Replica Set with the given repl-id.

This functions in much the same way as a POST request to /replica_sets, except that the id is given as part of the URI rather than the request body. The response from the server is very similar to that of a GET to /replica_sets/{repl-id}.

  • GET - info about ReplicaSet object

    available response representations:

    • 200 - application/json

    Example:

{
    "auth_key": null,
    "id": "b3a50b05-c396-45a5-a36f-bf98635b1fc5",
    "links": [
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5",
            "method": "DELETE",
            "rel": "delete-replica-set"
        },
        {
            "actions": [
                "reset"
            ],
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5",
            "method": "POST",
            "rel": "replica-set-command",
            "template": {
                "action": "<action name>"
            }
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members",
            "method": "GET",
            "rel": "get-replica-set-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members",
            "method": "POST",
            "rel": "add-replica-set-member"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/secondaries",
            "method": "GET",
            "rel": "get-replica-set-secondaries"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/primary",
            "method": "GET",
            "rel": "get-replica-set-primary"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/arbiters",
            "method": "GET",
            "rel": "get-replica-set-arbiters"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/servers",
            "method": "GET",
            "rel": "get-replica-set-servers"
        },
        {
            "href": "/v1",
            "method": "GET",
            "rel": "service"
        },
        {
            "href": "/v1/releases",
            "method": "GET",
            "rel": "get-releases"
        },
        {
            "href": "/v1/sharded_clusters",
            "method": "GET",
            "rel": "get-sharded-clusters"
        },
        {
            "href": "/v1/replica_sets",
            "method": "GET",
            "rel": "get-replica-sets"
        },
        {
            "href": "/v1/replica_sets",
            "method": "POST",
            "rel": "self"
        },
        {
            "href": "/v1/servers",
            "method": "GET",
            "rel": "get-servers"
        }
    ],
    "members": [
        {
            "_id": 0,
            "host": "localhost:1031",
            "links": [
                {
                    "href": "/v1/servers/a1f3ec6a-a065-4c88-b178-b6c4ed297c8a",
                    "method": "GET",
                    "rel": "get-server-info"
                },
                {
                    "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/0",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                }
            ],
            "server_id": "a1f3ec6a-a065-4c88-b178-b6c4ed297c8a"
        },
        {
            "_id": 1,
            "host": "localhost:1032",
            "links": [
                {
                    "href": "/v1/servers/5b8f8265-3999-4177-901f-ff868a59b7fe",
                    "method": "GET",
                    "rel": "get-server-info"
                },
                {
                    "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/1",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                }
            ],
            "server_id": "5b8f8265-3999-4177-901f-ff868a59b7fe"
        },
        {
            "_id": 2,
            "host": "localhost:1033",
            "links": [
                {
                    "href": "/v1/servers/1e6e1853-89c9-40f6-9111-928e59b0f0bf",
                    "method": "GET",
                    "rel": "get-server-info"
                },
                {
                    "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/2",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                }
            ],
            "server_id": "1e6e1853-89c9-40f6-9111-928e59b0f0bf"
        }
    ],
    "mongodb_uri": "mongodb://localhost:1031,localhost:1032,localhost:1033/?replicaSet=b3a50b05-c396-45a5-a36f-bf98635b1fc5",
    "orchestration": "replica_sets",
    "uri": "localhost:1031,localhost:1032,localhost:1033/?replicaSet=b3a50b05-c396-45a5-a36f-bf98635b1fc5"
}
+ 404 - Returned if the ReplicaSet does not exist
  • DELETE - remove ReplicaSet

    available response representations:

    + 204 - Returned if delete was successful
    + 400 - Returned if delete was fail
    

Note that the response body is empty if the ReplicaSet was removed successfully.

##/replica_sets/{repl-id}/members Parameters:

  • repl-id - string contains the replica set id

Methods:

  • POST - add new node to replica set

    Example:

{ "rsParams": { "hidden": true, "priority":0 }, "procParams": {"port": 4444} }
*available response representations:*
+ 200 - Provide a document describing the newly created Server.

   Example:
{
    "_id": 3,
    "links": [
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/3",
            "method": "GET",
            "rel": "get-replica-set-member-info"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/3",
            "method": "DELETE",
            "rel": "delete-replica-set-member"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/3",
            "method": "PATCH",
            "rel": "update-replica-set-member-config"
        },
        {
            "href": "/v1/servers/f2f5892e-54a0-4b11-9ecc-cba93d8fcf8f",
            "method": "GET",
            "rel": "get-server-info"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/primary",
            "method": "GET",
            "rel": "get-replica-set-primary"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members",
            "method": "GET",
            "rel": "get-replica-set-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/secondaries",
            "method": "GET",
            "rel": "get-replica-set-secondaries"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/arbiters",
            "method": "GET",
            "rel": "get-replica-set-arbiters"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/servers",
            "method": "GET",
            "rel": "get-replica-set-servers"
        },
        {
            "href": "/v1/replica_sets/None/members",
            "method": "POST",
            "rel": "self"
        }
    ],
    "procInfo": {
        "alive": true,
        "name": "mongod",
        "optfile": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-yiRGE6",
        "params": {
            "dbpath": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-L6CULB",
            "noprealloc": true,
            "oplogSize": 100,
            "port": 1034,
            "replSet": "b3a50b05-c396-45a5-a36f-bf98635b1fc5",
            "smallfiles": true
        },
        "pid": 90683
    },
    "rsInfo": {
        "primary": false,
        "secondary": true
    },
    "server_id": "f2f5892e-54a0-4b11-9ecc-cba93d8fcf8f",
    "statuses": {
        "locked": false,
        "mongos": false,
        "primary": false
    },
    "uri": "localhost:1034"
}
+ 500 - Returned if create replica set was fail
  • GET - return list of ReplicaSets members

    available response representations:

    + 200 - application/json
    
      Example:
    
{
    "links": [
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/primary",
            "method": "GET",
            "rel": "get-replica-set-primary"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members",
            "method": "GET",
            "rel": "self"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/secondaries",
            "method": "GET",
            "rel": "get-replica-set-secondaries"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/arbiters",
            "method": "GET",
            "rel": "get-replica-set-arbiters"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/servers",
            "method": "GET",
            "rel": "get-replica-set-servers"
        }
    ],
    "members": [
        {
            "_id": 0,
            "host": "localhost:1031",
            "links": [
                {
                    "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/0",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                },
                {
                    "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/0",
                    "method": "DELETE",
                    "rel": "delete-replica-set-member"
                },
                {
                    "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/0",
                    "method": "PATCH",
                    "rel": "update-replica-set-member-config"
                },
                {
                    "href": "/v1/servers/a1f3ec6a-a065-4c88-b178-b6c4ed297c8a",
                    "method": "GET",
                    "rel": "get-server-info"
                }
            ],
            "server_id": "a1f3ec6a-a065-4c88-b178-b6c4ed297c8a"
        },
        {
            "_id": 1,
            "host": "localhost:1032",
            "links": [
                {
                    "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/1",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                },
                {
                    "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/1",
                    "method": "DELETE",
                    "rel": "delete-replica-set-member"
                },
                {
                    "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/1",
                    "method": "PATCH",
                    "rel": "update-replica-set-member-config"
                },
                {
                    "href": "/v1/servers/5b8f8265-3999-4177-901f-ff868a59b7fe",
                    "method": "GET",
                    "rel": "get-server-info"
                }
            ],
            "server_id": "5b8f8265-3999-4177-901f-ff868a59b7fe"
        }
    ]
}
  + 404 - Returned if the ReplicaSet not exist

##/replica_sets/{repl-id}/members/{member-id} Parameters:

  • repl-id - string contains the replica set id
  • member-id - string contains the member id

Methods:

  • GET - info about member available response representations:
    • 200 - application/json Example:
{
    "_id": 0,
    "links": [
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/0",
            "method": "GET",
            "rel": "get-replica-set-member-info"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/0",
            "method": "DELETE",
            "rel": "delete-replica-set-member"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members/0",
            "method": "PATCH",
            "rel": "update-replica-set-member-config"
        },
        {
            "href": "/v1/servers/a1f3ec6a-a065-4c88-b178-b6c4ed297c8a",
            "method": "GET",
            "rel": "get-server-info"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/primary",
            "method": "GET",
            "rel": "get-replica-set-primary"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/members",
            "method": "GET",
            "rel": "get-replica-set-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/secondaries",
            "method": "GET",
            "rel": "get-replica-set-secondaries"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/arbiters",
            "method": "GET",
            "rel": "get-replica-set-arbiters"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/b3a50b05-c396-45a5-a36f-bf98635b1fc5/servers",
            "method": "GET",
            "rel": "get-replica-set-servers"
        }
    ],
    "procInfo": {
        "alive": true,
        "name": "mongod",
        "optfile": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-9O2c4H",
        "params": {
            "dbpath": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-dWXDM6",
            "ipv6": true,
            "journal": true,
            "nohttpinterface": true,
            "noprealloc": true,
            "nssize": 1,
            "oplogSize": 100,
            "port": 1031,
            "replSet": "b3a50b05-c396-45a5-a36f-bf98635b1fc5",
            "setParameter": {
                "enableTestCommands": 1
            },
            "smallfiles": true
        },
        "pid": 90643
    },
    "rsInfo": {
        "primary": true,
        "secondary": false,
        "tags": {
            "dc": "ny",
            "ordinal": "one"
        }
    },
    "server_id": "a1f3ec6a-a065-4c88-b178-b6c4ed297c8a",
    "statuses": {
        "locked": false,
        "mongos": false,
        "primary": true
    },
    "uri": "localhost:1031"
}
+ 404 - Returned if the member not exist
  • PATCH - change member params

    Example:

{"rsParams": {"hidden": false, "priority": 5}}
*available response representations:*
+ 200 - application/json
  Example
{
    "_id": 0,
    "links": [
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/0",
            "method": "GET",
            "rel": "get-replica-set-member-info"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/0",
            "method": "DELETE",
            "rel": "delete-replica-set-member"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/0",
            "method": "PATCH",
            "rel": "update-replica-set-member-config"
        },
        {
            "href": "/v1/servers/2c696902-1a59-48dd-9a66-efbfae4c4e7b",
            "method": "GET",
            "rel": "get-server-info"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/primary",
            "method": "GET",
            "rel": "get-replica-set-primary"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members",
            "method": "GET",
            "rel": "get-replica-set-members"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/secondaries",
            "method": "GET",
            "rel": "get-replica-set-secondaries"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/arbiters",
            "method": "GET",
            "rel": "get-replica-set-arbiters"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/servers",
            "method": "GET",
            "rel": "get-replica-set-servers"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/0",
            "method": "PATCH",
            "rel": "self"
        }
    ],
    "procInfo": {
        "alive": true,
        "name": "mongod",
        "optfile": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-YNuZsf",
        "params": {
            "dbpath": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-7MC_j8",
            "ipv6": true,
            "journal": true,
            "nohttpinterface": true,
            "noprealloc": true,
            "nssize": 1,
            "oplogSize": 100,
            "port": 1025,
            "replSet": "31e339f0-a505-44fa-9a17-1977b16d2e4a",
            "setParameter": {
                "enableTestCommands": 1
            },
            "smallfiles": true
        },
        "pid": 91034
    },
    "rsInfo": {
        "primary": true,
        "secondary": false,
        "tags": {
            "dc": "ny",
            "ordinal": "one"
        }
    },
    "server_id": "2c696902-1a59-48dd-9a66-efbfae4c4e7b",
    "statuses": {
        "locked": false,
        "mongos": false,
        "primary": true
    },
    "uri": "localhost:1025"
}
+ 500 - Returned if fail
  • DELETE - remove member from replica set (stopped instances and erase all data)

    available response representations:

    + 204 - Returned if delete was successful
    + 400 - Returned if delete was fail
    

Note that the response body is empty if the delete was successful.

##/replica_sets/{repl-id}/servers Parameters:

Methods:

  • GET - return information about each of this Replica Set's servers (does not include hidden nodes).

    Example: Suppose we create a replica set with the following configuration:

{
    "members": [
        {"name": "mongo_0"},
        {"name": "mongo_1"},
        {
            "name": "secret_mongo",
            "rsParams": {
                "hidden": true,
                "priority": 0
            }
        }
    ]
}

Then a GET to this URI would return the following:

{
    "links": [
        {
            "href": "/v1/replica_sets/myrepl/primary",
            "method": "GET",
            "rel": "get-replica-set-primary"
        },
        {
            "href": "/v1/replica_sets/myrepl",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/myrepl/members",
            "method": "GET",
            "rel": "get-replica-set-members"
        },
        {
            "href": "/v1/replica_sets/myrepl/secondaries",
            "method": "GET",
            "rel": "get-replica-set-secondaries"
        },
        {
            "href": "/v1/replica_sets/myrepl/arbiters",
            "method": "GET",
            "rel": "get-replica-set-arbiters"
        },
        {
            "href": "/v1/replica_sets/myrepl/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/myrepl/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/myrepl/servers",
            "method": "GET",
            "rel": "self"
        }
    ],
    "servers": [
        {
            "_id": 0,
            "host": "localhost:1028",
            "links": [
                {
                    "href": "/v1/replica_sets/myrepl/members/0",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                },
                {
                    "href": "/v1/replica_sets/myrepl/members/0",
                    "method": "DELETE",
                    "rel": "delete-replica-set-member"
                },
                {
                    "href": "/v1/replica_sets/myrepl/members/0",
                    "method": "PATCH",
                    "rel": "update-replica-set-member-config"
                },
                {
                    "href": "/v1/servers/43c3cade-e94f-4877-ad8f-1b46a7c5b041",
                    "method": "GET",
                    "rel": "get-server-info"
                }
            ],
            "server_id": "43c3cade-e94f-4877-ad8f-1b46a7c5b041"
        },
        {
            "_id": 1,
            "host": "localhost:1029",
            "links": [
                {
                    "href": "/v1/replica_sets/myrepl/members/1",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                },
                {
                    "href": "/v1/replica_sets/myrepl/members/1",
                    "method": "DELETE",
                    "rel": "delete-replica-set-member"
                },
                {
                    "href": "/v1/replica_sets/myrepl/members/1",
                    "method": "PATCH",
                    "rel": "update-replica-set-member-config"
                },
                {
                    "href": "/v1/servers/490de0a9-0e46-4615-802f-4f66e912110e",
                    "method": "GET",
                    "rel": "get-server-info"
                }
            ],
            "server_id": "490de0a9-0e46-4615-802f-4f66e912110e"
        }
    ]
}

##/replica_sets/{repl-id}/primary Parameters:

  • repl-id - string contains the replica set id

Methods:

  • GET - return info about primary member

    Example:

{
    "_id": 0,
    "links": [
        {
            "href": "/v1/replica_sets/myrepl/members/0",
            "method": "GET",
            "rel": "get-replica-set-member-info"
        },
        {
            "href": "/v1/replica_sets/myrepl/members/0",
            "method": "DELETE",
            "rel": "delete-replica-set-member"
        },
        {
            "href": "/v1/replica_sets/myrepl/members/0",
            "method": "PATCH",
            "rel": "update-replica-set-member-config"
        },
        {
            "href": "/v1/servers/43c3cade-e94f-4877-ad8f-1b46a7c5b041",
            "method": "GET",
            "rel": "get-server-info"
        },
        {
            "href": "/v1/replica_sets/myrepl/primary",
            "method": "GET",
            "rel": "self"
        },
        {
            "href": "/v1/replica_sets/myrepl",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/myrepl/members",
            "method": "GET",
            "rel": "get-replica-set-members"
        },
        {
            "href": "/v1/replica_sets/myrepl/secondaries",
            "method": "GET",
            "rel": "get-replica-set-secondaries"
        },
        {
            "href": "/v1/replica_sets/myrepl/arbiters",
            "method": "GET",
            "rel": "get-replica-set-arbiters"
        },
        {
            "href": "/v1/replica_sets/myrepl/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/myrepl/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/myrepl/servers",
            "method": "GET",
            "rel": "get-replica-set-servers"
        }
    ],
    "procInfo": {
        "alive": true,
        "name": "mongod",
        "optfile": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-SGFA6T",
        "params": {
            "dbpath": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-w_CFvR",
            "noprealloc": true,
            "oplogSize": 100,
            "port": 1028,
            "replSet": "myrepl",
            "smallfiles": true
        },
        "pid": 91153
    },
    "rsInfo": {
        "primary": true,
        "secondary": false
    },
    "server_id": "43c3cade-e94f-4877-ad8f-1b46a7c5b041",
    "statuses": {
        "locked": false,
        "mongos": false,
        "primary": true
    },
    "uri": "localhost:1028"
}

##/replica_sets/{repl-id}/secondaries Parameters:

  • repl-id - string contains the replica set id

Methods:

  • GET - return list of secondaries servers

    available response representations:

    • 200 - application/json Example:
{
    "links": [
        {
            "href": "/v1/replica_sets/myrepl/primary",
            "method": "GET",
            "rel": "get-replica-set-primary"
        },
        {
            "href": "/v1/replica_sets/myrepl",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/myrepl/members",
            "method": "GET",
            "rel": "get-replica-set-members"
        },
        {
            "href": "/v1/replica_sets/myrepl/secondaries",
            "method": "GET",
            "rel": "self"
        },
        {
            "href": "/v1/replica_sets/myrepl/arbiters",
            "method": "GET",
            "rel": "get-replica-set-arbiters"
        },
        {
            "href": "/v1/replica_sets/myrepl/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/myrepl/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/myrepl/servers",
            "method": "GET",
            "rel": "get-replica-set-servers"
        }
    ],
    "secondaries": [
        {
            "_id": 1,
            "host": "localhost:1029",
            "links": [
                {
                    "href": "/v1/replica_sets/myrepl/members/1",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                },
                {
                    "href": "/v1/replica_sets/myrepl/members/1",
                    "method": "DELETE",
                    "rel": "delete-replica-set-member"
                },
                {
                    "href": "/v1/replica_sets/myrepl/members/1",
                    "method": "PATCH",
                    "rel": "update-replica-set-member-config"
                },
                {
                    "href": "/v1/servers/490de0a9-0e46-4615-802f-4f66e912110e",
                    "method": "GET",
                    "rel": "get-server-info"
                }
            ],
            "server_id": "490de0a9-0e46-4615-802f-4f66e912110e"
        },
        {
            "_id": 2,
            "host": "localhost:1030",
            "links": [
                {
                    "href": "/v1/replica_sets/myrepl/members/2",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                },
                {
                    "href": "/v1/replica_sets/myrepl/members/2",
                    "method": "DELETE",
                    "rel": "delete-replica-set-member"
                },
                {
                    "href": "/v1/replica_sets/myrepl/members/2",
                    "method": "PATCH",
                    "rel": "update-replica-set-member-config"
                },
                {
                    "href": "/v1/servers/073e9b67-c372-493c-b01b-922cb618a466",
                    "method": "GET",
                    "rel": "get-server-info"
                }
            ],
            "server_id": "073e9b67-c372-493c-b01b-922cb618a466"
        }
    ]
}
*available response representations:*

  + 200 - if the primary stepdown successfully
  + 500 - if an error occurred when stepdown primary server

##/replica_sets/{repl-id}/arbiters Parameters:

  • repl-id - string contains the replica set id

Methods:

  • GET - return list of all arbiters for ReplicaSet

    available response representations:

    • 200 - application/json Example:
{
    "links": [
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/primary",
            "method": "GET",
            "rel": "get-replica-set-primary"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members",
            "method": "GET",
            "rel": "get-replica-set-members"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/secondaries",
            "method": "GET",
            "rel": "get-replica-set-secondaries"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/arbiters",
            "method": "GET",
            "rel": "self"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/servers",
            "method": "GET",
            "rel": "get-replica-set-servers"
        }
    ],
    "arbiters": [
        {
            "_id": 2,
            "host": "localhost:1027",
            "links": [
                {
                    "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/2",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                },
                {
                    "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/2",
                    "method": "DELETE",
                    "rel": "delete-replica-set-member"
                },
                {
                    "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/2",
                    "method": "PATCH",
                    "rel": "update-replica-set-member-config"
                },
                {
                    "href": "/v1/servers/c30010c2-520c-406d-86b0-2ae950ee0751",
                    "method": "GET",
                    "rel": "get-server-info"
                }
            ],
            "server_id": "c30010c2-520c-406d-86b0-2ae950ee0751"
        }
    ]
}

##/replica_sets/{repl-id}/hidden Parameters:

  • repl-id - string contains the replica set id

Methods:

  • GET - returl list of all hidden servers from ReplicaSet available response representations:
    • 200 - application/json Example:
{
    "hidden": [
        {
            "_id": 2,
            "host": "localhost:1027",
            "links": [
                {
                    "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/2",
                    "method": "GET",
                    "rel": "get-replica-set-member-info"
                },
                {
                    "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/2",
                    "method": "DELETE",
                    "rel": "delete-replica-set-member"
                },
                {
                    "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members/2",
                    "method": "PATCH",
                    "rel": "update-replica-set-member-config"
                },
                {
                    "href": "/v1/servers/c30010c2-520c-406d-86b0-2ae950ee0751",
                    "method": "GET",
                    "rel": "get-server-info"
                }
            ],
            "server_id": "c30010c2-520c-406d-86b0-2ae950ee0751"
        }
    ],
    "links": [
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/primary",
            "method": "GET",
            "rel": "get-replica-set-primary"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a",
            "method": "GET",
            "rel": "get-replica-set-info"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/members",
            "method": "GET",
            "rel": "get-replica-set-members"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/secondaries",
            "method": "GET",
            "rel": "get-replica-set-secondaries"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/arbiters",
            "method": "GET",
            "rel": "self"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/hidden",
            "method": "GET",
            "rel": "get-replica-set-hidden-members"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/passives",
            "method": "GET",
            "rel": "get-replica-set-passive-members"
        },
        {
            "href": "/v1/replica_sets/31e339f0-a505-44fa-9a17-1977b16d2e4a/servers",
            "method": "GET",
            "rel": "get-replica-set-servers"
        }
    ]
}
Clone this wiki locally