Bootstrap Your MySQL or MariaDB Galera Cluster Using Systemd

I had a brief power outage this morning, and I had to go lookup how to bootstrap my MaridDB Galera cluster again. I’m finally documenting it here to share it with you!

Use the commands below to start the first node in a MariaDB Galera Cluster or bootstrap a failed cluster. Make sure you run these commands on the most up-to-date node! The rest of the nodes can be started normally after the first one has been bootstrapped.

systemctl set-environment MYSQLD_OPTS="--wsrep-new-cluster"
sed -i 's/safe_to_bootstrap: 0/safe_to_bootstrap: 1/g' /var/lib/mysql/grastate.dat
systemctl start mariadb
systemctl unset-environment MYSQLD_OPTS

For more information on the second command, see this article under the section “Safe to Bootstrap” Protection. These commands were tested on CentOS 7 running MariaDB 10.1.38. Let me know if it works for you in the comments.

Leave a Reply

Your email address will not be published.