MariaDB MaxScale — Replica Rebuild – Part 6

Part 6 — The Magic

This multi-part series breaks down each section into easy logical steps.

If you have not completed part 1, start here.


Replica Rebuild

The MaxScale Replica Rebuild functionality is amazing. It brings a ‘Galera-like’ rebuild process to any replica servers. These servers could be brand new servers, which just have MariaDB installed, or they could be failed replicas. You could use this to create new replicas in distant data centres, cloud services, or anywhere, that you would like a copy of your database to be. The only requirement is that it has an SSH connection configured, and MariaDB installed.


To rebuild a replica server, from the MaxScale server we use the maxctrl command, calling the ‘async-rebuild-server’ functionality, we can build server2:

Bash
maxctrl call command mariadbmon async-rebuild-server Server-Monitor server2

Depending on the size of the database, the speed of the network and disks, will depend on how long this takes for the process to complete. I like to use a watch command on my MaxScale server so I can see when this is done:

Bash
watch "maxctrl list servers"

When server2 is showing as a ‘Slave, Running’ and the GTID numbers are synchronised. The secondary server is now in sync.

We can then move on to building the third server, by repeating the command on the MaxScale server:

Bash
maxctrl call command mariadbmon async-rebuild-server Server-Monitor server3

If you repeat the watch command, you will be able to see when the third server is up and running:

Bash
watch "maxctrl list servers"

Once the three servers are running and in sync, you have completed the Replica Rebuild process.

Move on to Part 7 to configure the rest of MaxScale, to allow it to take connections.


Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7 | Part 8 | Part 9

Kester Riley

Kester Riley is a Senior Solutions Engineer who leverages his website to establish his brand and build strong business relationships. Through his blog posts, Kester shares his expertise as a consultant, mentor, trainer, and presenter, providing innovative ideas and code examples to empower ambitious professionals.

CentOS (15) Connector (5) Continuous Availability (1) Cooperative Monitoring (3) High Availability (12) Java (3) MariaDB (16) MaxScale (14) Python (2) Replica Rebuild (10) Rocky Linux (15)

Leave a Reply

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