Ubuntu 18.04 (bionic) — percona-xtradb-cluster-server installation in GCP.

Ajaykumar
3 min readMay 27, 2020

--

Percona XtraDB Cluster is a fully open-source high-availability solution for MySQL. It integrates Percona Server and Percona XtraBackup with the Galera library to enable synchronous multi-master replication

A cluster consists of nodes, where each node contains the same set of data synchronized accross nodes. The recommended configuration is to have at least 3 nodes.

Step 1. Installing Percona Xtradb Cluster:

for installing percona cluster in ubuntu (bionic) ,run this below packages.

wget https://repo.percona.com/apt/percona-release_0.1-5.$(lsb_release -sc)_all.deb
dpkg -i percona-release_0.1-5.$(lsb_release -sc)_all.deb
apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get install percona-toolkit
apt-get install percona-xtradb-cluster-server
  • provide your desired root login credentials(MySQL).

Make sure Network between the server.

enable port 3306 for MySql.

After stop the mysql services.

Step 2: Configuring the first node in percona cluster

Go to the configuration file

in my case configuration file in below location.

vi /etc/mysql/percona-xtradb-cluster.conf.d/mysqld.cnf

wsrep_cluster_address=gcomm://0.0.0.0.,1.1.1.1,2.2.2.2   #mention private ip in all 3 nodes.wsrep_node_address=0.0.0.0pxc_strict_mode=DISABLEDwsrep_sst_auth="sstuser:PASSW0RD"  #sstuser mentiond any thing.

Performa all same activity on other nodes.

Note : wsrep_node_address provide the ip which respective of the server.

Step 3 : Perform the bootstarp only in Primary node.

/etc/init.d/mysql bootstrap-pxc

mysql> CREATE USER ‘sstuser’@’localhost’ IDENTIFIED BY ‘PASSW0RD’;
mysql> GRANT PROCESS, RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO ‘sstuser’@’localhost’;
mysql> FLUSH PRIVILEGES;

Step 4:

after create the use we will start the MySQl services in other two nodes.

go and check wsrep in Three nodes.

show status like 'wsrep%';Mysql> show status like 'wsrep%';
+----------------------------+--------------------------------------+
| Variable_name | Value |
+----------------------------+--------------------------------------+
| wsrep_local_state_uuid | 0fa2a976-314a-11ea-b9b3-9613ac1c6641 |
...
| wsrep_local_state | 4 |
| wsrep_local_state_comment | Synced |
...
| wsrep_cluster_size | 3 |
| wsrep_cluster_status | Primary |
| wsrep_connected | ON |
...
| wsrep_ready | ON |
+----------------------------+--------------------------------------+

Step 5:

check the cluster by creating database one of cluster node

To test the replication, lets create a new database on the second node, create a table for that database on the third node, and add some records to the table on the first node.

--

--

Ajaykumar
Ajaykumar

Written by Ajaykumar

Enriched with 6+ years of experience in IT with enhanced skills in Database Administration, Cloud Technologies like AZURE, AWS. Specializing in high volume

No responses yet