美文网首页javaWeb学习
MaxScale实现mysql读写分离,负载均衡

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

作者: 沐兮_d64c | 来源:发表于2017-06-22 22:00 被阅读1219次

文档地址: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/

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

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

相关文章

网友评论

    本文标题:MaxScale实现mysql读写分离,负载均衡

    本文链接:https://www.haomeiwen.com/subject/nyfqcxtx.html