环境说明:
主库:10.16.17.189
从库:10.16.17.190
端口:3306
os: centos6.5_64
db: mariadb 10.0.21
maxscale: maxscale-1.2.1-1.x86_64
为了快速实验 将maxscale安装在主库上的
1. Install the MariaDB Enterprise repository configuration package
rpm -i http://downloads.mariadb.com/enterprise/awjc-3f2j/generate/10.0/mariadb-enterprise-repository.rpm
2. Install the packages you want
yum install maxscale
3. 创建用户在主库上
grant SELECT on mysql.user to maxuser@'%' identified by 'redhat';
GRANT SELECT ON mysql.db TO maxuser@'%';
GRANT SHOW DATABASES ON *.* TO maxuser@'%';
grant REPLICATION SLAVE on *.* to maxuser@'%';
grant REPLICATION CLIENT on *.* to maxuser@'%';
4. 配置maxscale
它的配置文件准守INI文件配置格式配置如下:
[maxscale]
threads=4
[MySQL Monitor]
type=monitor
module=mysqlmon
servers=server1,server2
user=maxuser
passwd=redhat
monitor_interval=10000
[qla]
type=filter
module=qlafilter
options=/tmp/QueryLog
[fetch]
type=filter
module=regexfilter
match=fetch
repl

本文介绍了如何在CentOS 6.5上配置MaxScale 1.2.1,以实现MySQL/MariaDB的读写分离。通过安装MariaDB企业版仓库,然后安装MaxScale,创建特定用户并授予权限,最后配置MaxScale的监听服务和读写分离路由,确保MaxScale能够监控主从库并进行读写操作的正确分发。

1717

被折叠的 条评论
为什么被折叠?



