maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡

文档地址:https://github.com/mariadb-corporation/MaxScale/blob/2.1/Documentation/Documentation-Contents.md

1,maxscale安装

下载地址:https://downloads.mariadb.com/MaxScale/2.1.3/centos/7/x86_64/

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第1张图片

image.png

wget https://downloads.mariadb.com/MaxScale/2.1.3/centos/7/x86_64/maxscale-2.1.3-1.centos.7.x86_64.rpm

yum list installed | grep maxscale 查看是否安装过maxscale yum remove -y maxscale.x86_64 卸载之前的版本 yum install -y maxscale-2.1.3-1.centos.7.x86_64.rpm 安装rpm包

2,配置文件路径

vim /etc/maxscale.cnf 配置文件

/var/log/maxscale/maxscale.log日志文件

maxscale --config=/etc/maxscale.cnf---->maxadmin

/usr/share/maxscale/maxscale start / stop/ restart/ reload启动脚本 centos6 /etc/init.d/maxscale

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第2张图片

image.png

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第3张图片

image.png

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第4张图片

image.png

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第5张图片

image.png

3,mysql增加用户

添加maxscale监控以及获取user表信息的用户

create user 'maxscale'@'%' identified by 'maxscale';

grant select on mysql.user to 'maxscale'@'%';

grant select on mysql.db to 'maxscale'@'%';

grant select on mysql.tables_priv to 'maxscale'@'%';

grant show databases on . to 'maxscale'@'%';

grant replication client on . to 'maxscale'@'%';

(重点)添加连接maxscale代理的客户端用户。(机器多个ip,都要进行添加, 包括内网ip)

client用户,并增加代理访问db的权限。

grant all privileges on . to 'scaleclient'@'192.168.0.62' identified by 'scaleclient';

grant all privileges on . to 'scaleclient'@'192.168.0.63' identified by 'scaleclient';

登录代理若连不上代理,查看log或者是mysql用户权限配置不正确

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第6张图片

image.png

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第7张图片

image.png

4,maxadmin登录。

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第8张图片

image.png

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第9张图片

image.png

5, maxscale

Create the encrypted password using maxkeys and maxpasswd if you want to encrypt the password for the user that access the database servers:

maxscale连接mysql_MaxScale实现mysql读写分离,负载均衡_第10张图片

image.png

你可能感兴趣的:(maxscale连接mysql)