Search code examples
proxyamazon-auroramysql-8.0maxscale

Maxscale not detecting AWS Aurora 3/MySQL 8 replication slave


I have installed Maxscale v23.02.04 and am able to connect to my AWS RDS instances, and am trying to configure the readwritesplit to split traffic between read/writes.

However, whenever I run maxctrl list servers, the master mode is labeled as "Master, Running" but it is not displaying the read replica as a "Slave", and additionally isn't populating the "GTID" column.

screenshot

The RDS instances are running engine version "8.0.mysql_aurora.3.04.0". I've verified that the user connecting has "REPLICATION CLIENT". Here's the grants for the maxscale user:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE ROLE, DROP ROLE ON *.* TO `maxscale`@`%` WITH GRANT OPTION

Here's the full maxscale.cnf file for reference

[maxscale]
threads=auto
log_info=true

[dev_master]
type=server
address=***.***.us-east-1.rds.amazonaws.com
port=3306
protocol=MariaDBBackend

[dev_reader]
type=server
address=***.***.us-east-1.rds.amazonaws.com
port=3306
protocol=MariaDBBackend

[MySQL-Monitor]
type=monitor
module=mysqlmon
servers=dev_master, dev_reader
user=maxscale
password=password
monitor_interval=2s

[Read-Write-Service]
type=service
router=readwritesplit
servers=dev_master, dev_reader
user=maxscale
password=password

[Read-Write-Listener]
type=listener
service=Read-Write-Service
protocol=MariaDBClient
port=3306

Google led me to the Maxscale AuroraDB Monitor docs, but after getting errors about missing files I discovered that auroradbmon has been deprecated

I'm wondering if this maybe related to Aurora not being 100% compatible with MariaDB? If so, is there a way to get this to work with Aurora 3/MySQL 8?


Solution

  • Amazon Aurora does not use asynchronous replication which is why the mariadbmon module does not consider the replicas as valid replicating servers. This is also the reason why the GTID column isn't populated since the block-level replication that Aurora uses doesn't use the GTID mechanism.

    An additional reason for the GTID not being populated is that MariaDB GTIDs and MySQL GTIDs aren't compatible. MaxScale only supports the MariaDB GTID format and since Aurora is based off of MySQL 8, the GTIDs are incompatible. This won't prevent you from using MaxScale with MySQL 8, it just prevents you from using the features that depend on the GTID (e.g. read causality with causal_reads)


    Since you always know which endpoints in the Aurora cluster have which role, you can write your own monitoring script pretty easily using the maxctrl set server <name> <status> command. Here's an example that sets the dev_master server to the Master, Running status and the dev_reader server to the Slave, Running status:

    #!/bin/sh
    maxctrl set server dev_master running
    maxctrl set server dev_master master
    maxctrl set server dev_reader running
    maxctrl set server dev_reader slave
    

    After running this script you should be able to use MaxScale normally.

    A more advanced monitoring script would do a check to see if the Aurora nodes are actually up before setting the status bits but a minimally viable one doesn't need it.

    As for how to call this script, there are the usual options. You can use SystemD's ExecStartPost to run it after MaxScale has started up or you can have a cronjob that sets the status bits. The latter would also allow you to implement rudimentary monitoring in the script that was mentioned before.