通过Virtual IP无法访问到我的MySQL服务器,怎么回事,可以ping通的

load balancer Virtual IP 192.168.100.59

●Load balancer Machine 1
 IP Address:192.168.100.57(MySQL Cluster管理Machine)
 Hostname:loadb1
 Domain name:loadb1.localdomain.com

l●Load balancer Machine 2
 IP Address:192.168.100.58
 Hostname:loadb2
 Domain name:loadb2.localdomain.com

●SQL NODE/NDB NODE(Data NODE) 1
 IP Address:192.168.100.55
 Hostname:sql1
 Domain name:sql1.localdomain.com

●SQL NODE/NDB NODE(Data NODE) 2
 IP Address:192.168.100.56
 Hostname:sql2
 Domain name:sql2.localdomain.com

通过Virtual IP 192.168.100.59无法访问到192.168.100.55/192.168.100.56任意一个服务器。

heartbeat和ldirectord配置如下:
/etc/ha.d/ha.cf
logfacility local0
bcast eth0
mcast eth0 225.0.0.1 694 1 0
auto_failback off
node loadb1
node loadb2
respawn hacluster /usr/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster

/etc/ha.d/haresources
loadb1 \
IPaddr::192.168.100.59/24/eth0/192.168.100.255 \
ldirectord::ldirectord.cf \
LVSSyncDaemonSwap::master

/etc/ha.d/authkeys
auth 3
3 md5 somerandomstring

/etc/ha.d/ldirectord.cf
# Global Directives
checktimeout=10
checkinterval=2
#autoreload=no
logfile="local0"
#quiescent=yes
virtual = 192.168.100.59:3306
service = mysql
real = 192.168.100.55:3306 gate
real = 192.168.100.56:3306 gate
checktype = negotiate
login = "ldirector"
passwd = "ldirectorpassword"
database = "ldirectordb"
request = "SELECT * FROM connectioncheck"
scheduler = wrr

在192.168.100.57/192.168.100.58上:
/etc/init.d/ldirectord stop
/etc/init.d/heartbeat start
一切正常,没有发生错误。

loadb1:~# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.100.59:3306 wrr
-> 192.168.100.55:3306 Route 0 0 0
-> 192.168.100.56:3306 Route 0 0 0

从相同网络(192.168.100.x)中的其它服务器用虚拟IP地址192.168.100.59
来访问MySQL数据库: mysql -h 192.168.100.59 -u ldirector -p 失败!!!!

SmallLinux000:/usr/src# mysql -u ldirector -p -h 192.168.100.59
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.100.59' (111)

SmallLinux000:/usr/src# ping 192.168.100.59
PING 192.168.100.59 (192.168.100.59) 56(84) bytes of data.
64 bytes from 192.168.100.59: icmp_seq=1 ttl=64 time=0.628 ms
64 bytes from 192.168.100.59: icmp_seq=2 ttl=64 time=0.455 ms
64 bytes from 192.168.100.59: icmp_seq=3 ttl=64 time=0.493 ms
64 bytes from 192.168.100.59: icmp_seq=4 ttl=64 time=0.744 ms

Forums:

我也是这样,虽然采用的方式不一样,我用的是红帽子的piranha-gui来配置的,但是却也连不到虚拟IP地址的mysql

mysql的健康检查需要perl-DBD-mysql的支持

其他服务器可否通过192.168.100.55/56来访问mysql呢?就是说mysql里的账户允许从其他机器访问不?查看mysql库中的user表

randomness