第7章 Managing database replication with Galera
Red Hat OpenStack Platform uses the MariaDB Galera Cluster to manage database replication. Pacemaker runs the Galera service as a bundle set resource that manages the database master/slave status. You can use Galera to test and verify different aspects of the database cluster, such as hostname resolution, cluster integrity, node integrity, and database replication performance.
Similar to other Pacemaker services, you can use the pcs status
command to check that the Galera service is running, and on which Controller nodes it is running. For more information about viewing Pacemaker bundle status, see 「Viewing bundle status」.
When you investigate database cluster integrity, each node must meet the following criteria:
- The node is a part of the correct cluster.
- The node can write to the cluster.
- The node can receive queries and write commands from the cluster.
- The node is connected to other nodes in the cluster.
- The node is replicating write-sets to tables in the local database.
7.1. Verifying hostname resolution
By default, director binds the Galera resource to a hostname instead of an IP address. Therefore, any problems that prevent hostname resolution, such as misconfigured or failed DNS, might cause Pacemaker to incorrectly manage the Galera resource.
To troubleshoot the MariaDB Galera cluster, you first eliminate any hostname resolution problems, and then you check the write-set replication status on the database of each Controller node. To access the MySQL database, you use the password set by director during the overcloud deployment.
Procedure
From a Controller node, get the MariaDB database root password by running the
hiera
command.$ sudo hiera -c /etc/puppet/hiera.yaml "mysql::server::root_password" *<MYSQL-HIERA-PASSWORD>*
Get the name of the MariaDB container that runs on the node.
$ sudo docker ps | grep -i galera 5fb195b0d9e8 192.168.24.1:8787/rh-osbs/rhosp13-openstack-mariadb:pcmklatest "dumb-init -- /bin..." 7 hours ago Up 7 hours galera-bundle-docker-0
Get the write-set replication information from the MariaDB database on each node.
$ sudo docker exec galera-bundle-docker-0 sudo mysql -B --password="[MYSQL-HIERA-PASSWORD]" -e "SHOW GLOBAL STATUS LIKE 'wsrep_%';" +----------------------------+----------+ | Variable_name | Value | +----------------------------+----------+ | wsrep_applier_thread_count | 1 | | wsrep_apply_oooe | 0.018672 | | wsrep_apply_oool | 0.000630 | | wsrep_apply_window | 1.021942 | | ... | ... | +----------------------------+----------+
Each relevant variable uses the prefix
wsrep
.- Verify the health and integrity of the MariaDB Galera cluster by first checking that the cluster is reporting the correct number of nodes.