This is a read-only copy of the MariaDB Knowledgebase generated on 2025-05-01. For the latest, interactive version please visit https://mariadb.com/kb/.

Using Cooperative Locking for HA with MaxScale's MariaDB Monitor

Overview

MaxScale's MariaDB Monitor (mariadbmon) monitors MariaDB replication deployments.

When multiple MaxScale instances are used in a highly available deployment, MariaDB Monitor needs to ensure that only one MaxScale instance performs automatic failover operations at a given time. It does this by using cooperative locks on the back-end servers.

How MariaDB Monitor uses Cooperative Locks

When cooperative locking is enabled for MariaDB Monitor, it tries to acquire locks on the back-end servers with with GET_LOCK() function. If a specific MaxScale instance is able to acquire the lock on a majority of servers, then it is considered the primary MaxScale instance, which means that it can handle automatic failover.

Configuring Cooperative Locking

1. Configure cooperative locking by configuring the cooperative_monitoring_locks parameter for the MariaDB Monitor in maxscale.cnf. It has several possible values.

ValueDescription
noneDo not use any cooperative locking. This is the default value.
majority_of_allPrimary monitor requires locks on a majority of servers, even those which are down.
majority_of_runningPrimary monitor requires locks on a majority of running servers.

For example:

[repl-cluster]
type                     = monitor
module                   = mariadbmon
...
cooperative_monitoring_locks = majority_of_running

2. Restart the MaxScale instance.

$ sudo systemctl restart maxscale
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.