歡迎您光臨本站 註冊首頁

通過heartbeat配置的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
《解決方案》

回復 #1 hxcfindjob 的帖子

mysql的訪問規則配置正確么
《解決方案》

我分別在192.168.100.55/192.168.100.56上用如下語句開通了客戶端的訪問許可權,然後再同一網路的其他機器訪問的,還是不行。我的msn是hxcfindjob@gmail.com,方便網上交流一下嗎

GRANT ALL ON ldirectordb.* TO 'ldirector'@'%' IDENTIFIED BY 'ldirectorpassword;
《解決方案》

persistent

[火星人 ] 通過heartbeat配置的Virtual IP無法訪問到我的MySQL伺服器,怎麼回事,可以ping通的已經有589次圍觀

http://coctec.com/docs/service/show-post-6485.html