MariaDB MaxScale — High Availability – Part 2

Part 2 — MaxScale Cooperative Monitoring

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

If you have not completed part 1, start here.


By this point, you will have two MariaDB MaxScale servers configured, backed by an asynchronous cluster of MariaDB Enterprise Servers.

The second MaxScale server will load its configuration from the databases, and any configuration changes made on either MaxScale server will be reflected on the other.

Using the maxctrl tool we will list the servers:

Bash
maxctrl list servers

When you run this command, you should see some output similar to this:

If you see all three servers listed, it means that your new MaxScale Server is sharing the configuration.

Cooperative Monitoring Configuration

Cooperative monitoring is part of the mariadbmon monitor, and when we completed our initial system build, we set the configuration in Part 7 of my Replica Rebuild log.

We can alter the monitor’s behaviour by running:

Bash
maxctrl alter monitor Server-Monitor \
cooperative_monitoring_locks=majority_of_all

There are three options: none, majority_of_all and majority_of_running.

The majority_of_running option is only suitable for when the MariaDB database servers are in the same data centre.

The majority_of_all option is suitable for when your servers are distributed over multiple data centres, if too many nodes go down at the same time, you can end up in a situation where they are all marked as secondary servers. This setting should not be used on only two backend database servers.

Checking the configuration

One of the MaxScale servers will take the lock, you can check this by looking in the configured MaxScale log file, on both MaxScale servers:

Bash
cat /var/log/maxscale/maxscale.log | grep -i lock | tail -n 1

One of the servers will show it has the lock.

If you stop MaxScale on that server:

Bash
systemctl stop maxscale

and repeat the cat command on the other MaxScale Server, you will see it now has the lock.

On the server where MaxScale is currently stopped, start the service again:

Bash
systemctl start maxscale

Connecting your application

If your connector is capable of supporting multiple database servers, you can now add both of your MaxScale servers to the connection string, as an example, using the Java Connector you can use the sequential mode as described here.

Part 1 | Part 2

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.