环境说明:
主库: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