11.3. Node Management

11.3.1. Adding a node

Go to http://server1:5984/_membership to see the name of the node and all the nodes it knows about and are connected too.

curl -X GET "http://xxx.xxx.xxx.xxx:5984/_membership" --user admin-user
{
    "all_nodes":[
        "node1@xxx.xxx.xxx.xxx"],
    "cluster_nodes":[
        "node1@xxx.xxx.xxx.xxx"]
}
  • all_nodes are all the nodes thats this node knows about.
  • cluster_nodes are the nodes that are connected to this node.

To add a node simply do:

curl -X PUT "http://xxx.xxx.xxx.xxx:5986/_nodes/node2@yyy.yyy.yyy.yyy" -d {}

Now look at http://server1:5984/_membership again.

{
    "all_nodes":[
        "node1@xxx.xxx.xxx.xxx",
        "node2@yyy.yyy.yyy.yyy"
    ],
    "cluster_nodes":[
        "node1@xxx.xxx.xxx.xxx",
        "node2@yyy.yyy.yyy.yyy"
    ]
}

And you have a 2 node cluster :)

http://yyy.yyy.yyy.yyy:5984/_membership will show the same thing, so you only have to add a node once.

11.3.2. Removing a node

Before you remove a node, make sure that you have moved all shards away from that node.

To remove node2 from server yyy.yyy.yyy.yyy:

curl -X DELETE "http://xxx.xxx.xxx.xxx:5986/_nodes/node2@yyy.yyy.yyy.yyy" -d {}

Table Of Contents

Previous topic

11.2. Theory

Next topic

11.4. Database Management

More Help