4.2. Node Management

4.2.1. Adding a node

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

curl -X GET "http://xxx.xxx.xxx.xxx:5984/_membership" --user admin-user
{
    "all_nodes":[
        "[email protected]"],
    "cluster_nodes":[
        "[email protected]"]
}
  • 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/_node/_local/_nodes/[email protected]" -d {}

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

{
    "all_nodes":[
        "[email protected]",
        "[email protected]"
    ],
    "cluster_nodes":[
        "[email protected]",
        "[email protected]"
    ]
}

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.

4.2.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, you need to first know the revision of the document that signifies that node’s existence:

curl "http://xxx.xxx.xxx.xxx/_node/_local/_nodes/[email protected]"
{"_id":"[email protected]","_rev":"1-967a00dff5e02add41820138abb3284d"}

With that _rev, you can now proceed to delete the node document:

curl -X DELETE "http://xxx.xxx.xxx.xxx/_node/_local/_nodes/[email protected]?rev=1-967a00dff5e02add41820138abb3284d"