关于atlias读写分离问题

幽沉谢世事,俯默窥唐虞。这篇文章主要讲述关于atlias读写分离问题相关的知识,希望能为你提供帮助。
环境说明:
系统:CentOS Linux release 7.8.2003 (Core)
mysql:mysqlVer 8.0.24 for Linux on x86_64 (MySQL Community Server - GPL)(二进制安装)
共4个主机,GTID主从复制搭建完成,MHA安装在172.16.30.203主机上并已经启动(功用有VIP漂移和bingserver)
主库:172.16.30.202(主机名db02)
从库:172.16.30.201(主机名db01)
从库:172.16.30.203(主机名db03)
atlias安装在172.16.30.204(主机名db04)主机上,配置文件如下:
(安装的atlias版本:Atlas-2.2.1.el6.x86_64.rpm)
[root@db04 bin]# cat /usr/local/mysql-proxy/conf/test.cnf
[mysql-proxy]
admin-username = user
admin-password = pwd
proxy-backend-addresses = 172.16.30.250:3306#172.16.30.250是MHA虚拟的VIP地址;
proxy-read-only-backend-addresses = 172.16.30.201:3306,172.16.30.203:3306
pwds = repl:XA0rLg9XoGE=, mha:XA0rLg9XoGE=
daemon = true
keepalive = true
event-threads = 8
log-level = message
log-path = /usr/local/mysql-proxy/log
sql-log = ON
proxy-address = 0.0.0.0:1234
admin-address = 0.0.0.0:2345
charset = utf8
【关于atlias读写分离问题】启动alias
[root@db04 bin]# /usr/local/mysql-proxy/bin/mysql-proxyd test start
OK: MySQL-Proxy of test is started
[root@db04 bin]# netstat -ltnup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local AddressForeign AddressStatePID/Program name
tcp00 0.0.0.0:12340.0.0.0:*LISTEN25635/mysql-proxy
tcp00 0.0.0.0:220.0.0.0:*LISTEN960/sshd
tcp00 127.0.0.1:250.0.0.0:*LISTEN1267/master
tcp00 0.0.0.0:23450.0.0.0:*LISTEN25635/mysql-proxy
tcp600 :::22:::*LISTEN960/sshd
tcp600 ::1:25:::*LISTEN1267/master
[root@db04 tools]# ps -ef |grep mysql-proxy
root2563410 11:13 ?00:00:00 /usr/local/mysql-proxy/bin/mysql-proxy --defaults-file=/usr/local/mysql-proxy/conf/test.cnf
root25635 256340 11:13 ?00:00:00 /usr/local/mysql-proxy/bin/mysql-proxy --defaults-file=/usr/local/mysql-proxy/conf/test.cnf
root25935 134240 11:19 pts/200:00:00 grep --color=auto mysql-proxy

问题:无法登录altias,提示如下错误:db04这台主机没有启动mysql。
[root@db04 tools]# mysql -umha -p1122 -h 172.16.30.204 -P 1234
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user \'mha\'@\'172.16.30.204:60402\' (using password: YES)
[root@db04 tools]# mysql -uuser -ppwd -h 172.16.30.204 -P 2345
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): password doesn\'t match
不太清楚是什么问题,请各位帮小弟看看。先谢谢大家。


    推荐阅读