Installing Galera on Amazon Linux 2 for Geo-distributed Multi-master MySQL

We recently covered Installing Galera Cluster 4 with MySQL 8 on Ubuntu 18.04 , the new Galera version for MySQL High Availability. We got a request to see if we would be able to install it on Amazon Linux 2, and the short answer is yes, we are able to deploy Galera Cluster on Amazon Linux 2.

We have even published Installing a Galera Cluster on AWS guide for Geo-distributed MySQL Multi-master clustering which covers how to install a 3-node Galera Cluster on CentOS 7 to achieve disaster recovery . It turns out, Amazon Linux 2 tends to be quite compatible with this article (documentation). Heed the notices about how to configure SELinux, the firewall, as well as the security settings on AWS.

Today we will focus on installing Galera Cluster with MySQL 5.7 on Amazon Linux 2 (yes, the same instructions apply to installing the beta of MySQL 8 & Galera 4).

uname -a
Linux ip-172-30-0-54.ec2.internal 4.14.173-137.229.amzn2.x86_64 #1 SMP Wed Apr 1 18:06:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

[ec2-user@ip-172-30-0-54 ~]$ cat /etc/system-release
Amazon Linux release 2 (Karoo)

[ec2-user@ip-172-30-0-54 ~]$ cat /etc/os-release 
NAME="Amazon Linux"
ID_LIKE="centos rhel fedora"
PRETTY_NAME="Amazon Linux 2"

So beyond the article above, all you have to do is to ensure that there is a /etc/yum.repos.d/galera.repo file:

name = Galera
baseurl =
gpgkey =
gpgcheck = 1

name = MySQL-wsrep
baseurl =
gpgkey =
gpgcheck = 1

And then you install it via: sudo yum install galera-3 mysql-wsrep-5.7

Since this example took the smallest instance just for testing, a simple /etc/my.cnf was used to bootstrap a cluster:



wsrep_provider_options="gcache.size=128M; gcache.page_size=128M"

When you install MySQL 5.7, you’ll have to remember that you need to grab the password from the MySQL log, so do this via grep password /var/log/mysqld.log. After that, login and remember to change the root password by doing something like alter user 'root'@'localhost' identified with mysql_native_password by 'rootyes123A!';. Go ahead and run mysqld_bootstrap on the first node, and start MySQL normally on the 2nd and 3rd nodes.

We ran the MySQL test suite which has Galera Cluster tests as well, and the tests passed. As a company, Codership, considers the Amazon Linux 2 distribution compatible with our CentOS 7 binaries. Don’t forget we also release for Ubuntu, Debian, CentOS, openSUSE, Red Hat Enterprise Linux, and SUSE Enterprise Linux. This is of course in addition to FreeBSD. Expect a lot more distributions when MySQL 8 + Galera 4 goes Generally Available (GA).