搜索
您的当前位置:首页正文

MaxScale实现mysql读写分离,负载均衡

来源:二三娱乐

1,maxscale安装

image.png wget
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,配置文件路径

image.png
image.png
image.png
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用户权限配置不正确

image.png
image.png

4,maxadmin登录。

image.png
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:

image.png
Top