Bachelor Tech
  • Home
  • Tutorials
  • Tips
  • Portfolio
  • About Jan
  • Contact Jan

7. Configure Galera on each CT

by Jan Bachelor October 24, 2025

Let’s SSH into the individual nodes to set them up.

  • On the first node:
systemctl stop mariadb
nano /etc/mysql/mariadb.conf.d/60-galera.cnf

[mysqld]
# MySQL-related settings
bind-address = 0.0.0.0
binlog_format = ROW
default_storage_engine = InnoDB
innodb_autoinc_lock_mode = 2

# This setting provides better write performance at a small risk of data
# loss on OS crash (not just DB crash). In a multi-node cluster, this is an acceptable
# and common setting, as data exists on other nodes.
innodb_flush_log_at_trx_commit = 2
innodb_log_file_size = 256M
innodb_log_buffer_size = 64M

# A shorter lock wait timeout fails faster in a cluster environment,
# which is generally preferred over long waits.
innodb_lock_wait_timeout = 60

# The InnoDB buffer pool is the most critical performance setting.
# Set this to ~70% of the server's available RAM if it's a dedicated database server.
innodb_buffer_pool_size = 800M

# Skip trying to resolve names since we are using IP addresses
skip-name-resolve

# Allow for more attempts to prevent HAProxy from being blocked
max_connect_errors = 1000

# Logs not only errors but warnings, too (older more compatible method from log_error_verbosity)):
log_warnings = 1

wait_timeout = 1800
interactive_timeout = 1800
max_allowed_packet = 1G

[galera]
# Galera Provider Configuration
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so

# Note: The gcache stores writesets for nodes that briefly disconnect.
# A larger gcache allows for a longer disconnect time before a full SST is required.
wsrep_provider_options="gcache.size=512M;gcs.fc_limit=128;gcs.fc_factor=0.8"

# Galera Cluster Configuration (ADJUST - same on each node)
wsrep_cluster_name="clusterA"
# Info about each node (ADJUST - same on each node)
wsrep_cluster_address="gcomm://192.168.8.71,192.168.8.72,192.168.8.73,192.168.8.74"

# The newer non-blocking method is mariadb, the older one is rsync (ports need to be opened!)
wsrep_sst_method = mariabackup

# SST user for syncinging, same for each node. UPDATE!
wsrep_sst_auth = sst_user:MySuperSecurePassword

# Galera Node Configuration (ADJUST FOR EACH NODE)
wsrep_node_address = "192.168.8.71" # <-- CHANGE THIS ON EACH NODE
wsrep_node_name = "galera-a1"      # <-- CHANGE THIS ON EACH NODE
wsrep_sst_receive_address = "192.168.8.71" # <-- CHANGE THIS ON EACH NODE
  • Once done, do not yet try starting the mysql service, because it will fail due to not seeing any node in the cluster yet (not even itself). Instead, initiate the new cluster and check that you can see one unit:
# Initiate the galera cluster from the first node:
galera_new_cluster

# Check that the output shows '1'
mysql -e "SHOW STATUS LIKE 'wsrep_cluster_size';"

# Now start the MariaDB service!
systemctl start mariadb
  • The result of the mysql query should look like this:
Check that an initial cluster with one node was created
Check that an initial cluster with one node was created
  • Let’s head to the ‘galera-A2’ node and set it up in a similar way – just ensure to change the last few rows.
systemctl stop mariadb

nano /etc/mysql/mariadb.conf.d/60-galera.cnf

# Copy the same config file as above with the difference in the last two rows:

# Galera Node Configuration (ADJUST FOR EACH NODE)
wsrep_node_address = "192.168.8.72" # <-- CHANGE THIS ON EACH NODE
wsrep_node_name = "galera-a2"      # <-- CHANGE THIS ON EACH NODE
wsrep_sst_receive_address = "192.168.8.72" # <-- CHANGE THIS ON EACH NODE

# Exit with save. Do not start a new cluster by runnning 'galera_new_cluster'.

# Start the MariaDB service:
systemctl start mariadb

# Verify that the service started and the node joined the cluster
systemctl status mariadb

# Check how many nodes are in the cluster
mysql -e "SHOW STATUS LIKE 'wsrep_cluster_size';"
  • Here is how the output may look like (from node A2 that was just added to the cluster):
Cluster build in progress - two nodes and counting
Two nodes Galera cluster
  • Rinse and repeat with ‘galera-A3’ and ‘galera-A4’, each time:
    • Stop the MariaDB service
    • Edit the 60-galera.conf file
    • Copy paste the full config that we used on the ‘galera-A1’ node.
    • Edit the last two rows to capture the node’s IP and hostname
    • Start the MariaDB service again (or reboot the container)
  • Once all for nodes have been added to the cluster, you can run mysql -e "SHOW STATUS LIKE 'wsrep_cluster_size';" on any of them and should get the value of 4.
Final state - a 4 nodes Galera cluster
Final state – 4 nodes in our Galera Cluster
6. Deploy 4x LXC containers on 2x Proxmox nodes
8. Configure HAPRoxy for your Galera cluster
Go back to course overview: Deploy MariaDB Galera Cluster on Proxmox

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 FacebookWhatsappEmail

Course Steps

  1. 1. Galera Cluster - what is it and why is it good for your home set up
  2. 2. Create your first container as a template on Proxmox
  3. 3. Create an SST user on your template container
  4. 4. Security Hardening & Logging on Galera template LXC
  5. 5. Turn the MariaDB container to a template - full vs linked clones?
  6. 6. Deploy 4x LXC containers on 2x Proxmox nodes
  7. 7. Configure Galera on each CT
  8. 8. Configure HAPRoxy for your Galera cluster
  9. 9. Understanding Quorum - When the Raspberry Pi comes in
  10. 10. Set up Monitoring - UpTime Kuma
  11. 11. Entrust your Galera Cluster with data
  12. 12. Beyond the set up - recovery & self-healing options

Other courses

Create an automated Gravity workflow that will allow...

January 19, 2024

Dynamically Populate Gravity Forms from Google Sheets (GSheets...

March 16, 2021

Concur Alternative: Import Employees’ Credit Card Expenses to...

January 19, 2024

Turn your Raspberry Pi into a Proxmox Backup...

July 13, 2025

Install iRedMail Mail Server As Proxmox VM With...

October 31, 2024

Recent Posts

  • How to get LXC containers for Proxmox outside of ready-made templates

  • How to join two Proxmox nodes into a cluster (PVE 8.x)

  • How to Rename a Proxmox Node

Facebook Twitter Instagram Pinterest Linkedin Youtube

All Rights Reserved. The theme was customized from Soledad, see PenciDesign

Bachelor Tech
  • Home
  • Tutorials
  • Tips
  • Portfolio
  • About Jan
  • Contact Jan