vkoster
vkoster

Reputation: 45

couchdb 2.0 installation and singel node setup

after installing couchdb 2.0 the docs ask you to to this:

After installation and initial startup, visit Fauxton at http://127.0.0.01:5984/_utils#setup. You will be asked to set up CouchDB as a single-node instance or set up a cluster.

This gets in the way when automating the intallation process. What is actually going on when you decide for one option or the other? Can the same results be achieved via API calls?

Thanks for any insights volker

Upvotes: 1

Views: 1650

Answers (1)

Alexis Côté
Alexis Côté

Reputation: 3690

Of course :)

Documentation from the couchdb-documentation repository.


The Cluster Setup Api

If you would prefer to manually configure your CouchDB cluster, CouchDB exposes the _cluster_setup endpoint for that. After installation and initial setup. We can setup the cluster. On each node we need to run the following command to setup the node:

 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"}'

After that we can join all the nodes together. Choose one node as the "setup coordination node" to run all these commands on. This is a "setup coordination node" that manages the setup and requires all other nodes to be able to see it and vice versa. Setup will not work with unavailable nodes. The notion of "setup coordination node" will be gone once the setup is finished. From then onwards the cluster will no longer have a "setup coordination node". To add a node run these two commands:

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, "remote_node": "<remote-node-ip>", "remote_current_user": "<remote-node-username>", "remote_current_password": "<remote-node-password>" }'
curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "add_node", "host":"<remote-node-ip>", "port": "<remote-node-port>", "username": "garren", "password":"password"}' -H "Content-Type: application/json"

This will join the two nodes together. Keep running the above commands for each node you want to add to the cluster. Once this is done run the following command to complete the setup and add the missing databases:

curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "finish_cluster"}'

You CouchDB cluster is now setup.


Source : https://github.com/apache/couchdb-documentation/blob/master/src/cluster/setup.rst

Upvotes: 3

Related Questions