Galera cluster deployment based on docker swarm using Linux Containers (LXC) with automatic deployment via Ansible.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
3.2 KiB

4 years ago
### Relevant Info
5 years ago
4 years ago
For information regarding the tools used for this virtual lab with useful relevant links please read [README.md](https://git.swarmlab.io:3000/cs171027/galera-swarm-lxc-ansible/src/branch/master/README.md)
4 years ago
For information regarding the initial installation of all the necessary components please read [INSTALL.md](https://git.swarmlab.io:3000/cs171027/galera-swarm-lxc-ansible/src/branch/master/INSTALL.md)
### General command-line information for virtual lab usage
Command for checking the docker node status by default from inside the manager node (which is the same as the host machine): ```docker node ls```
5 years ago
5 years ago
Command for using and attaching to LXC container (e.g. to 'worker1'): ```lxc-attach --name worker1```.
4 years ago
4 years ago
One possible limitation of the deployment process with docker swarm, is that static ip assignments [are missing in docker
swarm](https://forums.docker.com/t/docker-swarm-1-13-static-ips-for-containers/28060/13), and so the deployment process is based on the overlay networks, the inclusion of which inside the service deployment adds a degree of environmental complexity for the Galera cluster setup, especially since we use a [custom stack deployment](https://git.swarmlab.io:3000/cs171027/galera-swarm-lxc-ansible/src/branch/master/stack.yaml) for the ```mariadb-galera-swarm``` image.
4 years ago
For checking the service status this command is suitable with the output from below:
```docker service ls```
4 years ago
```ID NAME MODE REPLICAS IMAGE PORTS
zwueb8s59c0j stack_anode replicated 1/1 colinmollenhour/mariadb-galera-swarm:latest
cl7qlf0hmntp stack_bnode replicated 1/1 colinmollenhour/mariadb-galera-swarm:latest
```
For checking the status of the Linux Containers see the following command: ```lxc-ls --fancy```
```
NAME STATE AUTOSTART GROUPS IPV4 IPV6
worker1 RUNNING 0 - 10.0.3.100, 172.17.0.1, 172.18.0.1 -
worker2 RUNNING 0 - 10.0.3.101, 172.17.0.1, 172.18.0.1 -
```
### Galera cluster debugging
For checking the current size of the Galera cluster - meaning all the current nodes connected to the cluster - there exist some useful commands, which should be executed inside the docker container cluster nodes (```docker exec -it {container_id} sh```), e.g inside the first MariaDB server node:
4 years ago
```
mysql -u root -e "SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size%';"
```
4 years ago
In case the result of this command is 1, it means that only one MariaDB server is running inside the cluster, which is the server from which the cluster is bootstraping from (see also inside the file ```/var/lib/mysql/grastate.dat``` if this line exists: ```safe_to_bootstrap: 1``` to confirm that this is the case).
4 years ago
* **Manual Healthcheck (inside LXC containers)**: ```docker exec {container_id} healthcheck.sh```
Also, a new database, named e.g "database" and defined inside the "stack.yaml" deployment file, should initially appear inside the Galera cluster on all the MariaDB nodes:
```
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| database |
```