Skip to content

Instantly share code, notes, and snippets.

@alkavan
Last active September 29, 2017 09:33
Show Gist options
  • Save alkavan/55a2ce9661725c440d2f9e223d0dc2b4 to your computer and use it in GitHub Desktop.
Save alkavan/55a2ce9661725c440d2f9e223d0dc2b4 to your computer and use it in GitHub Desktop.
CentOS-7_x-Percona-5_7-Server-Cluster

Stage 1 - System update and common setup procedure

Update system

# yum update

Set system time to UTC timezone

# timedatectl set-timezone UTC

Stage 2 - Install Percona YUM repository, and enable system service

Add repository to system

yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm

List percona packages

yum list | grep percona

Install packages

yum install -y \
Percona-XtraDB-Cluster-57 \
Percona-XtraDB-Cluster-client-57 \
Percona-XtraDB-Cluster-devel-57 \
Percona-XtraDB-Cluster-full-57 \
Percona-XtraDB-Cluster-garbd-57 \
Percona-XtraDB-Cluster-server-57 \
Percona-XtraDB-Cluster-shared-57 \
Percona-XtraDB-Cluster-test-57

Fire up the service and enable on boot

systemctl start mysql
systemctl enable mysql

Add 'mysql' service to firewall

firewall-cmd --zone=public --add-service=mysql
firewall-cmd --zone=public --add-service=mysql --permanent

Now reboot and systemctl status mysql, you should see something like:

... percona1 mysql-systemd[868]: SUCCESS!
... percona1 systemd[1]: Started Percona XtraDB Cluster.

Set new percona root password

vi ~/.mysql_pass

Reset default percona root password

password=$(cat /var/log/mysqld.log | grep "A temporary password is generated for" | tail -1 | sed -n 's/.*root@localhost: //p')
new_password=`cat ~/.mysql_pass`
mysql --connect-expired-password -uroot -p$password -Bse "ALTER USER 'root'@'localhost' IDENTIFIED BY '$new_password';"

Login into percona server

mysql -p`cat ~/.mysql_pass`

Stage 3 - Configure Instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment