https://mariadb.com/kb/en/mariadb-maxscale-25-mariadb-maxscale-configuration-guide/
创建监控用户
create user scalemon@'%' identified by "Scalemon@123"; grant replication slave, replication client on *.* to scalemon@'%';
创建路由用户
create user maxscale@'%' identified by "Maxscale@123"; grant select on mysql.* to maxscale@'%';
GRANT SELECT ON mysql.user TO 'maxscale'@'%'; GRANT SELECT ON mysql.db TO 'maxscale'@'%'; GRANT SELECT ON mysql.tables_priv TO 'maxscale'@'%'; GRANT SELECT ON mysql.columns_priv TO 'maxscale'@'%'; GRANT SELECT ON mysql.proxies_priv TO 'maxscale'@'%'; -- GRANT SELECT ON mysql.roles_mapping TO 'maxscale'@'%'; GRANT SHOW DATABASES ON *.* TO 'maxscale'@'%';
设置/etc/maxscale.cnf文件内容:
# MaxScale documentation:
# https://mariadb.com/kb/en/mariadb-maxscale-24/
# Global parameters
#
# Complete list of configuration options:
# https://mariadb.com/kb/en/mariadb-maxscale-24-mariadb-maxscale-configuration-guide/
[maxscale]
threads=auto
# Server definitions
#
# Set the address of the server to the network
# address of a MariaDB server.
#
[server1]
type=server
address=192.168.66.101
port=13306
protocol=MariaDBBackend
[server2]
type=server
address=192.168.66.102
port=13306
protocol=MariaDBBackend
[server3]
type=server
address=192.168.66.103
port=13306
protocol=MariaDBBackend
# Monitor for the servers
#
# This will keep MaxScale aware of the state of the servers.
# MariaDB Monitor documentation:
# https://mariadb.com/kb/en/mariadb-maxscale-24-mariadb-monitor/
[MariaDB