How to Install and Set Up Percona XtraDB Cluster
Percona XtraDB Cluster is a high-availability solution for MySQL that provides synchronous replication and automatic node failover. This tutorial will guide you through the process of installing and configuring Percona XtraDB Cluster on a CentOS 7 server.
Step 1: Add Percona repository
First, add the Percona repository to your server:
javascriptsudo yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
Step 2: Install Percona XtraDB Cluster
Next, install Percona XtraDB Cluster:
sqlsudo yum install Percona-XtraDB-Cluster-full-57
Step 3: Configure Percona XtraDB Cluster
Create a configuration file for Percona XtraDB Cluster:
bashsudo vi /etc/my.cnf.d/server.cnf
Add the following lines to the file:
makefile[mysqld] wsrep_on=ON wsrep_provider=/usr/lib64/galera3/libgalera_smm.so wsrep_cluster_name=pxc-cluster wsrep_cluster_address=gcomm:// wsrep_node_name=node1 wsrep_node_address=<ip-address> wsrep_sst_method=xtrabackup-v2
Replace <ip-address>
with the IP address of the current node.
Step 4: Start Percona XtraDB Cluster
Start Percona XtraDB Cluster on the first node:
sqlsudo systemctl start mysql
Step 5: Add nodes to the cluster
On the other nodes, install Percona XtraDB Cluster and create a configuration file as in Step 3. Then, start Percona XtraDB Cluster:
sqlsudo systemctl start mysql
Step 6: Verify the cluster status
Verify the status of the cluster by running the following command on any node:
pythonmysql -u root -p -e SHOW STATUS LIKE 'wsrep_cluster_size'
You should see the number of nodes in the cluster.
That's it! You have successfully installed and configured Percona XtraDB Cluster on your CentOS 7 server.