Training Video Examples

Installing Galera Cluster with MySQL

These examples are part of the training video, Installing Galera Cluster with MySQL. They correspond to what was taught, and should be done after each viewing section, unless otherwise noted.

Before starting these exercises, make sure you have all of the requirements and preparations in place.

Requirements & Preparation

  • Test Servers: 3
  • Operating System: Linux
  • Software: Don’t install MariaDB or Galera Cluster in preparation.

Before starting an exercise, read it fully and carefully. The headings for each set of exercises corresponds to the section with the same name in training video. Make notes for yourself as you go along, for when you have to do these tasks for your job or for yourself.

Database Configuration (/etc/my.cnf)

Do these exercises after viewing the first two sections of the training video: Galera Cluster Overview, and Installing Software on Nodes. Don’t configure the nodes until the next section.

# MySQL Options

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
bind-address=0.0.0.0
user=mysql

default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=0
innodb_buffer_pool_size=128M

binlog_format=ROW
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

# Galera Options

wsrep_on=ON
wsrep_provider=/usr/lib64/galera-3/libgalera_smm.so

wsrep_node_name='galera-2'
wsrep_node_address="172.31.23.129"

wsrep_cluster_name='galera-training'
wsrep_cluster_address="gcomm://172.31.18.216,172.31.23.129,172.31.25.198"
wsrep_provider_options="gcache.size=300M; gcache.page_size=300M"
wsrep_slave_threads=4
wsrep_sst_method=rsync

Note

If you use MySQL-wsrep 8.0.26 or newer, use wsrep_applier_threads instead of wsrep_slave_threads, in the configuration file.

Configuring Nodes & Opening Ports

Do these exercises after viewing the section with the two titles. MariaDB should be down on each node; don’t start mysqld again until the next section.

Note

If you struggled at any point in doing these exercises, especially in getting the Galera nodes started, you might want to do them again. Start with fresh installations of the servers, without MariaDB or Galera Cluster. If you use the same servers, before doing the exercises again, uninstall MariaDB and Galera, and delete MariaDB’s data directory. Do the exercises multiple times, until you’re able to install, configure, and start a Galera cluster without any problems.