2
votes

I'm following this documentation :

http://docs.couchdb.org/en/latest/cluster/setup.html#the-cluster-setup-api

The 11.1 part: The Cluster Setup API

I have 3 ubuntu machines with CouchDB and Curl installed, with the following ips :

  • 192.168.219.138
  • 192.168.219.139
  • 192.168.219.140

First step, as the doc says, i'm entering the following commands on each of the 3 machines (admin password have been set.) :

> curl -X POST -H "Content-Type: application/json"
> http://admin:[email protected]:5984/_cluster_setup -d '{"action":
> "enable_cluster", "bind_address":"0.0.0.0", "username": "admin",
> "password":"password", "node_count":"3"}'

it says this on each machines :

{"ok":true}

Second step, i go on the 192.168.219.139 (setup coordination node) and try adding the nodes, so I'm entering theses commands, just like the doc is mentionning :

curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"password", "port": 15984, "node_count": "3", "remote_node": "192.168.219.138", "remote_current_user": "admin", "remote_current_password": "password" }'
curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "add_node", "host":"192.168.219.138", "port": 5684, "username": "admin", "password":"password"}'
curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"password", "port": 15984, "node_count": "3", "remote_node": "192.168.219.140", "remote_current_user": "admin", "remote_current_password": "password" }'
curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "add_node", "host":"192.168.219.140", "port": 5684, "username": "admin", "password":"password"}'

Then, i do this command to check if my cluster is ok :

curl http://admin:[email protected]:5984/_membership

And this is the answer, all the nodes are missing :

    {
    "all_nodes": [
        "couchdb@localhost"
    ],
    "cluster_nodes": [
        "[email protected]",
        "[email protected]",
        "couchdb@locahost"
    ]
}

Please notice, the doc says I'm supposed to get this :

{
    "all_nodes": [
        "couchdb@couch1",
        "couchdb@couch2",
         "couchdb@couch3"
    ],
    "cluster_nodes": [
        "couchdb@couch1",
        "couchdb@couch2",
         "couchdb@couch3"
    ]
}

I guess my cluster is not functional, could you please tell me what am I doing wrong?

Thank you .

For example, then I go to the 192.168.219.139, add a new database called 'establishments' and nothing happens on both 2 others nodes !!

1

1 Answers

0
votes

Not sure if this was a typo, but under second step, you have:

curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"password", "port": 15984, "node_count": "3", "remote_node": "192.168.219.138", "remote_current_user": "admin", "remote_current_password": "password" }'

Notice "port": 15984

But if that's not the issue, there could be a host of issues. The clustering operations happen over the erlang ports, so the different nodes will also have to speak over the EPMD port (4396) as well as a range of other ports, which you can restrict. Each node should have a configuration (e.g. in the vm.args file) with this erlang flag, -name couchdb@${node-ip-address|FQDN} as well as a cookie that the couch nodes use to speak with each other. Of course, depending on factors outside of what you shared, there could be other considerations as well.