Install Uncloud CLI locally firts: https://uncloud.run/docs/getting-started/install-cli
# Create a 3-machine Uncloud cluster
uc machine init -n machine1 root@server1
uc machine add -n machine2 root@server2
uc machine add -n machine3 root@server3
# Deploy the first bootstrap node
uc deploy --profile bootstrap galera1-bootstrap
# Until compose configs implemented: https://github.com/psviderski/uncloud/issues/43
# Manually copy galera1,2,3.cnf to /var/lib/docker/volumes/galera1,2,3-conf/_data/galera.cnf on machines
# Restart the galera1-bootstrap service to pick up the new config
uc deploy --profile bootstrap galera1-bootstrap --recreate
# Deploy galera2 and galera3 services and wait for them to form the cluster
uc deploy galera2 galera3
# Remove the bootstrap node (using --wsrep-new-cluster) and replace it with a normal one
uc rm galera1-bootstrap
# Deploy all services, including the missing galera1
uc deploy
# Test on any machine
docker exec -it galera1-li6p mariadb -u root -psecret-password -e "
SELECT * FROM information_schema.GLOBAL_STATUS
WHERE VARIABLE_NAME IN ('wsrep_cluster_size', 'wsrep_cluster_status', 'wsrep_ready', 'wsrep_connected')
ORDER BY VARIABLE_NAME;"
+----------------------+----------------+
| VARIABLE_NAME | VARIABLE_VALUE |
+----------------------+----------------+
| WSREP_CLUSTER_SIZE | 3 |
| WSREP_CLUSTER_STATUS | Primary |
| WSREP_CONNECTED | ON |
| WSREP_READY | ON |
+----------------------+----------------+Now, your Uncloud services are able to communicate with the Galera Cluster via any if its nodes by using galera1:3306,
galera2:3306, or galera3:3306 addresses. You can also deploy a Galera Load Balancer or HAProxy in front of the nodes
to provide a single endpoint to the cluster.