alba fernandez
alba fernandez

Reputation: 21

How can I check if the cluster has been initialized or not in Couchbase?

I have a docker-compose file to run a Couchbase container, but when the cluster has been initialized, and then stop and start again the container I have the following error: enter image description here

my docker-compose.yml

enter image description here

is there any way to check if the cluster is already initialized or not?.

Upvotes: 2

Views: 1052

Answers (2)

dnault
dnault

Reputation: 8909

The couchbase-cli serverlist command will succeed if the cluster initialized, and fail if it is uninitialized.

couchbase-cli server-list --username Administrator --password password --cluster localhost

Alternatively, you can inspect the result of this HTTP request:

curl http://localhost:8091/pools/default/ -u Administrator:password

Thank you to HouseHippo and omatrot who discussed this on the Couchbase Forum https://forums.couchbase.com/t/couchbase-cli-check-if-a-cluster-has-been-set-up/4936

Upvotes: 1

Matthew Groves
Matthew Groves

Reputation: 26149

You might want to look at wait-for-it.sh, which is a script to wait until a host/port is available. You can include this in your own custom image.

Another possibility is taking a look at these couchbasefakeit images. You may or may not want to use one of those images, but certainly you can look at the techniques used in them.

Upvotes: 0

Related Questions