I'm using a maxscale (6.2) readwritesplit router with 3 galera servers (mariadb 10.4). 2 of them are in DC1, and a 3rd one is on a distant DC2.
Using ranks is the only option I see here, as priority
will be used by galeramon to select the master.
My goal is to tell maxscale to use DC1 as much as possible, so server1 as master (priority=1, rank=primary), server2 as slave (priority=2, rank=primary), and use DC2 server3 only if server1 or server2 are not reachable (priority=3, rank=secondary).
Is this the correct behavior?
[server1]
type=server
address=192.168.0.11
priority=1
rank=primary
[server2]
type=server
address=192.168.0.12
priority=2
rank=primary
[server3]
type=server
address=192.168.0.21
priority=3
rank=secondary
[split]
type=service
router=readwritesplit
servers=server1,server2,server3
[monitor]
type=monitor
module=galeramon
servers=server1,server2,server3
root_node_as_master=true
use_priority=true
Yes, the readwritesplit module only uses connections that have the same rank
. This means that if both server1
and server2
fail, the readwritesplit service will use server3
as long as it is up.
When either of the two other servers comes back up, the galeramon monitor will shift the Master
label from server3
to one of the other nodes. At that point readwritesplit will discard the connection to server3
and reconnect to the nodes with the higher rank, if possible.