How to Install and Set Up Percona XtraDB Cluster

In the future, using the website cloudhosting.lv, you agree to the rules of using Cookies. Read more. I agree

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:

sudo yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm

Step 2: Install Percona XtraDB Cluster

Next, install Percona XtraDB Cluster:

sudo yum install Percona-XtraDB-Cluster-full-57

Step 3: Configure Percona XtraDB Cluster

Create a configuration file for Percona XtraDB Cluster:

sudo vi /etc/my.cnf.d/server.cnf

Add the following lines to the file:

[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= wsrep_sst_method=xtrabackup-v2

Replace with the IP address of the current node.

Step 4: Start Percona XtraDB Cluster

Start Percona XtraDB Cluster on the first node:

sudo 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:

sudo systemctl start mysql

Step 6: Verify the cluster status

Verify the status of the cluster by running the following command on any node:

mysql -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.