You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to set up a couchdb cluster with docker swarm.
The initialization of the cluster goes pretty well, but when I restart my stack, none of my couchdb nodes reboot.
I have the following error:
{"Kernel pid terminated",application_controller,"{application_start_failure,setup,{{bad_return_value,{setup_error,\"Cluster setup timed out waiting for nodes to connect\"}},{setup_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,setup,{{bad_return_value,{setup_error,"Cluster setup timed out waiting for nodes to connect"}},{setup_app,start,[normal,[]]}}
#!/usr/bin/env sh## CouchDB Cluster Init Service## Waits for CouchDB nodes to come online, then configures the nodes in a cluster.#echo"Initialising a 3-node CouchDB cluster"# Set up admin users (this has been pulled up into local.ini of the cluster-node Dockerfile)#curl -s -X PUT https://couchdb1:5984/_node/couchdb@couchdb1/_config/admins/admin -d '"secret"'#curl -s -X PUT https://couchdb2:5984/_node/couchdb@couchdb2/_config/admins/admin -d '"secret"'#curl -s -X PUT https://couchdb3:5984/_node/couchdb@couchdb3/_config/admins/admin -d '"secret"'# Check all nodes activeecho"Check all nodes active"functionwaitForNode() {
echo"Waiting for ${1}"
NODE_ACTIVE=""until [ "${NODE_ACTIVE}"="ok" ];do
sleep 1
NODE_ACTIVE=$(curl -s -X GET https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@${1}:5984/_up | jq -r .status)done
}
waitForNode couchdb1
waitForNode couchdb2
waitForNode couchdb3
# Check cluster status and exit if already set upecho"Check cluster status and exit if already set up"
ALL_NODES_COUNT=$(curl -s -X GET https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_membership | jq '.all_nodes | length')if [ "${ALL_NODES_COUNT}"-eq 3 ] ;thenecho"CouchDB cluster already set up with ${ALL_NODES_COUNT} nodes"
curl -s -X GET https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_membership | jq '.all_nodes'
tail -f /dev/null
fi# Configure consistent UUID on all nodesecho"Configure consistent UUID on all nodes"
SHARED_UUID=$(curl -s -X GET https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_uuids | jq .uuids[0])
curl -s -X PUT https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_node/_local/_config/couchdb/uuid -d "${SHARED_UUID}"
curl -s -X PUT https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb2:5984/_node/_local/_config/couchdb/uuid -d "${SHARED_UUID}"
curl -s -X PUT https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb3:5984/_node/_local/_config/couchdb/uuid -d "${SHARED_UUID}"# Set up common shared secretecho"Set up common shared secret"
SHARED_SECRET=$(curl -s -X GET https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_uuids | jq .uuids[0])
curl -s -X PUT https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_node/_local/_config/couch_httpd_auth/secret -d "${SHARED_SECRET}"
curl -s -X PUT https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb2:5984/_node/_local/_config/couch_httpd_auth/secret -d "${SHARED_SECRET}"
curl -s -X PUT https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb3:5984/_node/_local/_config/couch_httpd_auth/secret -d "${SHARED_SECRET}"# Enable cluster (looks to be redundant, as it seems configuring an admin user implicitly marks the cluster as enabled)#curl -s -X POST https://couchdb1:5984/_cluster_setup -H "content-type:application/json" -d '{"action":"enable_cluster","username": "'"${COUCHDB_USER}"'", "password":"'"${COUCHDB_PASSWORD}"'","bind_address":"0.0.0.0","node_count":3}'# Configure nodes 2 and 3 on node 1echo"Configure nodes 2 and 3 on node 1"
curl -s -X POST https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_cluster_setup -H "Content-Type: application/json" -d '{"action":"enable_cluster","remote_node":"couchdb2.cluster","port":"5984","username": "'"${COUCHDB_USER}"'", "password":"'"${COUCHDB_PASSWORD}"'","bind_address":"0.0.0.0","node_count":3}'
curl -s -X POST https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_cluster_setup -H "Content-Type: application/json" -d '{"action":"enable_cluster","remote_node":"couchdb3.cluster","port":"5984","username": "'"${COUCHDB_USER}"'", "password":"'"${COUCHDB_PASSWORD}"'","bind_address":"0.0.0.0","node_count":3}'# Add nodes 2 and 3 on node 1echo"Add nodes 2 and 3 on node 1"
curl -s -X POST https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_cluster_setup -H "Content-Type: application/json" -d '{"action":"add_node","host":"couchdb2.cluster","port":"5984","username": "'"${COUCHDB_USER}"'", "password":"'"${COUCHDB_PASSWORD}"'"}'
curl -s -X POST https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_cluster_setup -H "Content-Type: application/json" -d '{"action":"add_node","host":"couchdb3.cluster","port":"5984","username": "'"${COUCHDB_USER}"'", "password":"'"${COUCHDB_PASSWORD}"'"}'# Finish clusterecho"Finish cluster"
curl -s -X POST https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_cluster_setup -H "Content-Type: application/json" -d '{"action": "finish_cluster"}'
curl -s -X POST https://admin:a@couchdb1:5984/_cluster_setup -H "Content-Type: application/json" -d '{"action": "finish_cluster"}'# Check cluster membershipecho"Check cluster membership"
curl -s -X GET https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb1:5984/_membership | jq
# Done!echo"Done!"echo"Check https://localhost:5984/_haproxy_stats for HAProxy info."echo"Use https://localhost:5984/_utils for CouchDB admin."
tail -f /dev/null
Description
Hello to all,
I want to set up a couchdb cluster with docker swarm.
The initialization of the cluster goes pretty well, but when I restart my stack, none of my couchdb nodes reboot.
I have the following error:
This complet log is available here :
6gvvekwlgg3rnaf3trp4d4y8e_logs.txt
I'm running out of ideas on the problem, I've changed machines, changed versions of docker, changed versions of couchdb...
i need your help !
My Docker swarm
My Script for setup the cluster :
Steps to Reproduce
docker stack deploy -c docker-compose-swarm-couchdb.yml couchdb_swarm
docker stack rm couchdb_swarm
docker stack deploy -c docker-compose-swarm-couchdb.yml couchdb_swarm
Additional information :
Docker init cluster :
The text was updated successfully, but these errors were encountered: