MaxScale 2.5 Cooperative Monitoring
HTML-код
- Опубликовано: 5 ноя 2024
- We are going to be discussing MariaDB MaxScale 2.5 and it's new capability "Cooperative Monitoring"
Cooperative monitoring gives us the capability of having multiple MaxScale nodes running on top of our backend setup and still be able to handle MariaDB automatic failover when the Primary DB goes down.
Terminal Emulator, as always, It's "terminator" :)
0:00 - 7:53 blabbering :)
7:54 Cooperative Monitoring (majority_of_all)
11:44 "majority_of_all" visual representation
17:42 Cooperative Monitoring (majority_of_running)
21:26 "majority_of_running" visual representation
28:21 Cooperative Monitoring Demo
;~)
Perfect instructor. Thanks.
Hi Faisal,
Thanks for the demo, it was very helpful.
I have a question. If we have 2 MaxScale servers managing even number of MariaDB servers, is there a chance the 2 MaxScale server ending up acquiring equal number of locks? Another word, is having even number of MariaDB servers not a good idea? Thanks.
Great point! Yes, it is possible that both MaxScale nodes end up in a split-brain scenario. But on the other hand, when we start both MaxScale nodes at the exact same time, one of the MaxScale acquires the lock on the backend databases first before the other one gets a chance. To be sure, we can intentionally create a delay when starting the MaxScale nodes.
But you are absolutely right. There might still be a remote possibility that both maxscale starting at exactly the same time will have one lock each.
3 Nodes in the backend are safer. But even if the MaxScale nodes are in a split-brain we can easily fix it by stopping one of the MaxScale nodes and starting it again after a few seconds :)
@@faisalee Many thanks for quick response.
Your reply brought up another question. You said that "But even if the MaxScale nodes are in a split-brain". How do I know if they are in split-brain? Is there a command that will tell me how many locks each MaxScale server has acquired? Also, is there a command that will tell me which MariaDB backend server is locked by which MaxScale server? Thanks.
Hi Faisal,
Quick question. When you have more than one Maxscale node, how do you handle the application connection to the Maxscale servers? I know there is a ConnectorJ for Java applications, but not all applications use Java.
Do you use Keepalived along with cooperative monitoring?
Thanks,
Hi Roya,
Great question, other connectors in MariaDB also have this capability with the exception of the C/C++ connector. Regardless of that, clients that I know of, use a load balancer between the application layer and MaxScale nodes to round-robin connections between the two MaxScale nodes. Or if you want to keep it simple, you could use KeepaliveD which gives you a Virtual IP for the app to connect to. But this also means that only one MaxScale could be used at any given time by the application. The database failover can be handled by both MaxScale nodes using Cooperative Locking :)
@@faisalee Thanks. We have been considering KeepaliveD, but the fact that we will be utilizing just one of the Maxscale servers at a time, has been an issue to go with Keepalived. Also, I am not sure if we decide to use keepalived, why cooperative monitoring would be needed. In that situation, one maxscale server will do it all, i.e. processing queries, Failover, rejoin and switchover actions. I cannot see the point of having both Keepalived and cooperative monitoring together.
@@royayaz The purpose of keepalived and cooperative monitoring are totally different. KeepaliveD will provide you with a virtual IP to connect to both MaxScale nods, 1 at a time. While Cooperative monitoring controlls which of the two MaxScale is going to do the MariaDB server automatic failover in case of the Master node goes down :)
@@faisalee Thanks for reply. Are you saying that if we implement keepalived, the MariaDB nodes' failover (and rejoin) will no longer be handled by maxscale, unless we add cooperative monitoring?
@@royayaz Not really, KeepAliveD only provides Virtual IP between the two MaxScale nodes. Cooperative Monitoring controls out of the two MaxScale nodes, which one will do the database failover. So if you don't use Cooperative Monitoring, which makes no sense as to why not, you will have to control the automatic failover manually through the KeepAlive scripting which is not very user friendly. Finally, Cooperative Monitoring is a part of MaxScale so not using it does not make sense to me :)
Hi Faisal,
I have built a 2-node MaxScale environment that currently monitors 2-node MariaDB Master-Replica node (will be adding a 3rd node later). I took master MariaDB Down, but my primary MaxScale server is unable to do the failover, giving the following reason:
error : [mariadbmon] Can not select 'node1' as a demotion target for failover because it does not have a 'gtid_binlog_pos' and unsafe failover is disabled.
What am I doing wrong?
Thanks,
Roya
Hi Roya, make sure you have `log_slave_updates=1` in your server.cnf file under [mariadb] section. Also, make sure that when you set up replication, you are using `master_use_gtid=slave_pos` in the `CHANGE MASTER` command.
If I have a synchronized maxscale cluster, if I want to change the config, what can I do?
With a Galera cluster, you don't need Cooperative Monitoring. You can directly use more than 1 MaxScale node for the same cluster. Just make sure that all the MaxSclae nodes have the same configuration
@@faisalee Now that I'm using master/slave, I would like to discuss if I want to change my config with 2 maxscale machines synchronized, how can I do that?
What tool you used for multiple cmd windows ?
That's "Terminator" emulator for Winodows, you can also use cmder from "cmder.net" for multi planes on the same terminal window. The new Windows terminal also supports this however :)
@@faisalee Thanks
Hi , If i am using VIP , how we can achive ?
Does not matter if you are using VIP, as long as the VIP can connect to one of the MaxScale nodes your app will work fine. Both MaxScale nodes are active the only difference is that the Node holding the majority of locks will be the one doing Master/Slave promotion.
@@faisalee Thanks for giving information. Here Node means Maxscale Server Right ? Is there anyway to check metadata information about GET_LOCKS for co-op monitoring from Maria DB main server ?
and n_servers means considering maxscale nodes only or DB nodes ?
@@vasudevarao9789 n_servers is always MariaDB servers. I don't think you can get the number of locks or the metadata you are looking for.