How to install Percona XtraDB Cluster
Jump to navigation
Jump to search
For this tutorial, we will be installing:
- Percona-XetraDB-cluster 5.7
- Haproxy version 1.6.3
- sysbench version 1.0.12
Prerequisites
To complete this tutorial, you'll need the following:
- Four(4) Debian 9(Stretch) servers
This lab has been tested also on Ubuntu 14.04 and Xenial 16.04.
Servername | IP adress | Node Role |
db1 | 10.192.16.58 | First db server |
db2 | 10.192.16.59 | Second db server |
db3 | 10.192.16.60 | Third db server |
web1 | 10.192.16.61 | Test client |
STEP 1- Install Debian 9 on all 4 servers
Make sure that you install Debian 9 on all servers and all servers are up to date by runnimg the commands below after the install.
sudo apt-get update
sudo apt-get -y upgrade
Note: If you are not running a DNS server in your environment, make sure you update you /etc/hosts file on each node.
127.0.0.1 localhost 10.192.16.58 db1 10.192.16.59 db2 10.192.16.60 db3 10.192.16.61 web1 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
STEP 2- Install Percona_XtraDB-Cluster on db1,db2 and db3
- Login as root
- Use "vim" or "nano" to create a new file "percona.sh".
- Copy the script below and paste it into the new file.
Percona install script:
#!/bin/bash #update all nodes sudo apt-get update sudo apt-get -y upgrade #Install Percon-Xtradb-cluster sudo apt-get -y install wget cd /tmp/ wget https://repo.percona.com/apt/percona-release_0.1-5.$(lsb_release -sc)_all.deb sudo dpkg -i percona-release_0.1-5.$(lsb_release -sc)_all.deb sudo apt-get update sudo apt-get -y install percona-xtradb-cluster-57 #Stop mysqld on all nodes sudo systemctl stop mysql
- Save the file and close it
- Make the file executable
chmod +x percona.sh
- Run the script
./percona.sh
During the install, you will be asked to enter the "mysql root password". Enter a password
Use the same password for all 3 nodes
- After the install complete, check mysql is not running on all node.The script should stop mysql, but it is always good to check.
systemctl status mysql Active: inactive (dead)
if mysql is running stop it with:
systemctl stop mysql