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:
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:
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:
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:
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:
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
Leave a Reply
You must be logged in to post a comment.