Manual SST of Galera Cluster node with Mariabackup

You are viewing an old version of this article. View the current version here.

Sometimes it can be helpful to perform a "manual SST" when Galera's automatic SSTs fail. A manual SST essentially consists of taking a backup of the donor, loading the backup on the joiner, and then manually editing the cluster state on the joiner node. This page will show how to perform this process with Mariabackup.

Contents

  1. Process

Process

  • Create backup directory on donor.
MYSQL_BACKUP_DIR=/mysql_backup
mkdir $MYSQL_BACKUP_DIR
  • Take full backup of donor with mariabackup. Be sure to include “--galera-info” flag.
DB_USER=sstuser
DB_USER_PASS=password
mariabackup --backup --user=$DB_USER --password=$DB_USER_PASS --galera-info --no-timestamp --target-dir $MYSQL_BACKUP_DIR
  • Verify that MariaDB on joiner is stopped.

On SysV init systems:

service mysql status

On systemd systems:

systemctl status mariadb
  • Create backup directory on joiner.
MYSQL_BACKUP_DIR=/mysql_backup
mkdir $MYSQL_BACKUP_DIR
  • Copy backup from donor to joiner.
OS_USER=dba
JOINER_HOST=dbserver2.mariadb.com
rsync -av $MYSQL_BACKUP_DIR/* ${OS_USER}@${JOINER_HOST}:${MYSQL_BACKUP_DIR}
  • Prepare the backup on the joiner.
mariabackup --prepare --target-dir $MYSQL_BACKUP_DIR
  • Get Galera version from the donor's grastate.dat file.
MYSQL_DATADIR=/var/lib/mysql
cat $MYSQL_DATADIR/grastate.dat | grep version

An example version number would be "2.1".

  • Get Galera cluster state from xtrabackup_galera_info on the backup that was copied to the joiner.
cat $MYSQL_BACKUP_DIR/xtrabackup_galera_info

Example output:

d38587ce-246c-11e5-bcce-6bbd0831cc0f:1352215
  • Create Galera state file in the backup directory of the joiner by splitting the uuid and seqno from xtrabackup_galera_info, and version from the donor’s grastate.dat file.

For example, with the example values from the last two steps, we could do:

sudo tee $MYSQL_BACKUP_DIR/grastate.dat <<EOF
# GALERA saved state
version: 2.1
uuid:    d38587ce-246c-11e5-bcce-6bbd0831cc0f
seqno:   1352215
safe_to_bootstrap: 0
EOF
  • Prepare datadir on joiner by removing contents.
MYSQL_DATADIR=/var/lib/mysql
rm -Rf $MYSQL_DATADIR/*
  • Copy backup contents to datadir on joiner.
cp -R $MYSQL_BACKUP_DIR/* $MYSQL_DATADIR/
  • Make sure permissions are good on joiner.
chown -R mysql:mysql $MYSQL_DATADIR/
  • Start MariaDB on joiner.

On SysV init systems:

service mysql start

On systemd systems:

systemctl start mariadb
  • Watch MariaDB error log and verify that the joiner does not do an automatic SST on startup.
tail -f /var/log/mysql/mysqld.log

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.