Percona XtraDB Cluster 8.0 on Ubuntu 20.04LTS
Percona XtraDB Cluster is a database clustering solution for MySQL. It ensures high availability, prevents downtime and data loss, and provides linear scalability for a growing environment. This is very efficient in managing data and replicating it between nodes. It can be a life saver in many ways where we have a chance of hardware failure along with other issues. Installation of Percona XtraDB Cluster 8.0 on Ubuntu 20.04LTS is pretty straight forward yet can be a problematic nightmare if you are just following the guides provided by official Percona XtraDB cluster.
The standard apt-get install percona-xtradb-cluster will not work as its only for older versions, also in my case the client wanted to have an installation without internet connection so I had to find all the packages required for installation. I would recommend to use dpkg command to install as its pretty easy and you just need to download the package to destination server and issue the command. Follow this link to download the latest Percona XtraDB Cluster 8.0.
Under listed command can be used to install Percona XtraDB Cluster 8.0 on Ubuntu 20.04LTS:
apt-get install percona-xtradb-cluster=1:8.0.25-15-1.focal percona-xtradb-cluster-client=1:8.0.25-15-1.focal percona-xtradb-cluster-common=1:8.0.25-15-1.focal percona-xtradb-cluster-server=1:8.0.25-15-1.focal -V
Adjust the version according to the packages you downloaded earlier from latest release download page.
There are few pre-requisites like Firewall configuration for different ports required for connectivity between nodes. Follow this link to get the ports to be opened on firewall. A brief list of ports is given as under:
3306, 4444, 4567, 4568
During installation the installer will ask for MySQL root password but surely people will enter and try to use the same password after installation which will never be accepted by the first node. The reason: Percona XtraDB Cluster 8.0 on Ubuntu 20.04LTS has also started generating a temporary password which can be find at under given location:
cat /var/log/mysql/error.log | grep 'temporary password'
Bootstrap the first Node:
sudo systemctl start [email protected] mysql -u root -p
provide temporary password to login to Percona XtraDB Cluster 8.0 on Ubuntu 20.04LTS.
Change temporary root password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
Temporary password change is mandatory to issue any command.
on mysql console check the cluster status by issuing the under give command:
show status like 'wsrep%';
The default configuration file will come with no cluster IP addresses and Node Address. The first bootstrap without any IP address will consider to invoke the process of cluster creation. Once the cluster is bootstrap, you can change the cluster IP addresses and Node Address.
Configuration file information is given in the link below:
By default all nodes will connect on Secure connection and for that you need to configure SSL certificate to encrypt the traffic between nodes. If the SSL certificate is not configured correctly, the second node will never join even if you have switched off the firewall and did everything according to the documentation. All you can do is to disable the Secure connection between nodes and for that you need to edit mysqld.conf on all nodes and add under listed parameters:
Mostly newbies like me don’t have good knowledge of SSL certificate configuration on Percona XtraDB Cluster 8.0 so they do it for lab environment, please don’t do it on production.