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

本文档介绍了如何安装MaxScale,配置MaxScale以实现MySQL的读写分离和负载均衡,包括MaxScale的安装步骤、配置文件设置、MySQL用户权限配置以及Maxadmin的使用。通过创建和授权特定用户,确保MaxScale能够监控和访问数据库,从而实现高效的数据管理和处理。
摘要由CSDN通过智能技术生成

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

b1c41a143e4cd74423fb0ff9c8dc0a0a.png

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

ba2b9643cdcdd1c7dea058f4d7e2abc4.png

image.png

91439cd10f98600102532a9c90856a3c.png

image.png

d6d0e0adbc1cc2c90b1d7dedb7b33245.png

image.png

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

e1bb2e7915fc97bee2132a7d260895db.png

image.png

c394d72209f8217e6df3ddc9daa58db1.png

image.png

4,maxadmin登录。

921b0e0f74d8c6949eaa78bff3ca1a7d.png

image.png

b11242c0748b6f9c8020965497944f78.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:

ad3b7bc4a1c2d2b23fbb9e309a4c6ea9.png

image.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值