Last active
December 13, 2021 12:51
-
-
Save metal3d/be1dc1849011379391c62669d61e35ee to your computer and use it in GitHub Desktop.
Revisions
-
metal3d revised this gist
Dec 13, 2021 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # Configuration count=4 clustername=mycluster admin=admin password=password @@ -30,7 +30,9 @@ until [ $RESPOND == 1 ]; do done # now, init the cluster podman exec -it couch1 couchbase-cli cluster-init \ --cluster-name=${clustername} --cluster-username=${admin} --cluster-password=${password} \ --services fts,data,index,query # add others server to the cluster for i in $(seq 2 $count); do -
metal3d revised this gist
Dec 13, 2021 . 1 changed file with 16 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,14 @@ # Configuration count=2 clustername=mycluster admin=admin password=password networkname=couchbase volumename=couchbase # inside the pods, do not change it volumepath=/opt/couchbase/var # create a network podman network create ${networkname} @@ -13,11 +18,12 @@ for i in $(seq $count); do port1=$((8091 + (i-1)*4 )) port2=$((8094 + (i-1)*4 )) podman pod create --name server$i --network ${networkname} -p $port1-$port2:8091-8094 podman volume create ${volumename}${i} podman run -d --rm --name couch$i --pod server$i -v ${volumename}${i}:${volumepath} docker.io/couchbase:community done # wait for the server 1 to respond echo "Waiting for the first server to be up and running..." RESPOND=0 until [ $RESPOND == 1 ]; do podman exec -t couch1 bash -c 'curl -sf server1:8091 -o /dev/null' && RESPOND=1 @@ -28,6 +34,11 @@ podman exec -it couch1 couchbase-cli cluster-init --cluster-name=${clustername} # add others server to the cluster for i in $(seq 2 $count); do RESPOND=0 echo "Waiting server $i to be up and running..." until [ $RESPOND == 1 ]; do podman exec -t couch1 bash -c 'curl -sf server'${i}':8091 -o /dev/null' && RESPOND=1 done podman exec -it couch$i bash -c 'couchbase-cli server-add -c server1 -u '${admin}' -p '${password}' \ --server-add $(hostname -I) --server-add-username '${admin}' --server-add-password '${password} done @@ -43,6 +54,7 @@ echo To remove all: cat <<EOF for i in {1..$count}; do podman pod rm -f server\${i} podman volume rm ${volumename}\${i} done podman network rm ${networkname} EOF -
metal3d revised this gist
Dec 13, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # configuration count=2 clustername=mycluster admin=admin password=password -
metal3d created this gist
Dec 13, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ # configuration count=4 clustername=mycluster admin=admin password=password networkname=couchbase # create a network podman network create ${networkname} # and now create $count servers, decay ports for i in $(seq $count); do port1=$((8091 + (i-1)*4 )) port2=$((8094 + (i-1)*4 )) podman pod create --name server$i --network ${networkname} -p $port1-$port2:8091-8094 podman run -d --rm --name couch$i --pod server$i docker.io/couchbase:community done # wait for the server 1 to respond echo "Waiting for the first server to respond..." RESPOND=0 until [ $RESPOND == 1 ]; do podman exec -t couch1 bash -c 'curl -sf server1:8091 -o /dev/null' && RESPOND=1 done # now, init the cluster podman exec -it couch1 couchbase-cli cluster-init --cluster-name=${clustername} --cluster-username=${admin} --cluster-password=${password} # add others server to the cluster for i in $(seq 2 $count); do podman exec -it couch$i bash -c 'couchbase-cli server-add -c server1 -u '${admin}' -p '${password}' \ --server-add $(hostname -I) --server-add-username '${admin}' --server-add-password '${password} done # and rebalance podman exec -it couch1 couchbase-cli rebalance -u ${admin} -p ${password} -c server1 echo echo "CouchBase cluster accessible at http://localhost:8091" echo echo To remove all: cat <<EOF for i in {1..$count}; do podman pod rm -f server\${i} done podman network rm ${networkname} EOF