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/

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容