Databases 9 min read

How to Safely Backup a MySQL Galera Cluster Using State Snapshot Transfer

This guide explains how to back up a MySQL Galera Cluster by leveraging the State Snapshot Transfer (SST) mechanism, detailing the default and custom scripts, required parameters, execution flow, and the key benefits of using SST for point‑in‑time, non‑intrusive backups.

dbaplus Community
dbaplus Community
dbaplus Community
How to Safely Backup a MySQL Galera Cluster Using State Snapshot Transfer

MySQL Galera Cluster provides synchronous multi‑node replication with strong consistency, but traditional backup methods lack GTID support and can disrupt cluster operations. The Galera documentation recommends using State Snapshot Transfer (SST) to create reliable backups without affecting the running cluster.

Backup Overview

SST creates a full backup of a donor node by invoking a script that captures the database state together with its GTID. The same mechanism is used for a single‑instance backup, making the process uniform across Galera and standalone MySQL.

State Snapshot Transfer (SST) Mechanism

When a donor node initiates SST, it runs wsrep_sst_backup.sh (or a custom script) which packages the current data directory and GTID, then streams it to the joiner node. The joiner applies the snapshot and reports the final GTID, allowing precise point‑in‑time restoration.

Default SST Scripts

The Galera package includes two useful scripts: wsrep_sst_backup.sh – the standard script called by the donor during SST. wsrep_sst_common.sh – a helper script located in /usr/bin that parses arguments, logs errors, and can be used as a base for custom SST implementations.

Both scripts are flexible: they do not enforce a strict order or number of parameters, allowing users to add or ignore arguments as needed.

Key SST Parameters

Parameters are passed to the SST script by the Galera engine. They fall into three groups:

Common parameters (used by all SST scripts) role: identifies the node as donor or joiner. address: IP address of the joiner. auth: authentication string, set via wsrep_sst_auth. datadir: path to the MySQL data directory (from mysql_real_data_home). defaults-file: path to the MySQL configuration file (my.cnf).

Donor‑specific parameters gtid: GTID composed of state UUID and sequence number. socket: optional local server socket for communication. bypass: indicates whether to skip actual data transfer and send only GTID (useful for incremental transfers).

Logical SST parameters (used by wsrep_sst_mysqldump.sh ) user and password: credentials for the MySQL connection between donor and joiner. host and port: network address of the joiner. local-port: port used by the donor to send the snapshot.

Backup Procedure

The administrator selects an SST method (e.g., mysqldump) and sets wsrep_sst_method accordingly.

Galera chooses a donor node that is idle (no pending writes) and launches the appropriate wsrep_sst_<name>.sh script.

The script gathers the data directory, GTID, and any configured parameters, then streams the snapshot to the joiner.

The joiner receives the data, applies it, and outputs the final GTID; the script exits with status 0 to signal success.

Upon completion, the donor receives a “done” signal and also exits with status 0.

Advantages of SST‑Based Backup

Backups run at an automatically chosen point‑in‑time when the node has no pending writes, eliminating manual timing.

GTID is stored with the backup, enabling precise recovery from data loss or corruption.

The backup process does not keep the node synchronized with the cluster, so it does not consume bandwidth or block regular traffic.

The cluster avoids selecting a node that is currently performing a backup as a donor for another transfer, preventing conflicts.

All examples and command snippets referenced in this article are taken from the official Galera documentation (http://galeracluster.com/).

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

databasemysqlReplicationBackupGaleraSST
dbaplus Community
Written by

dbaplus Community

Enterprise-level professional community for Database, BigData, and AIOps. Daily original articles, weekly online tech talks, monthly offline salons, and quarterly XCOPS&DAMS conferences—delivered by industry experts.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.