lvs 虚拟ip 无法启动
[root@localhost ha.d]# cat ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 1000ms
deadtime 30
warntime 5
initdead 120
udpport 694
ucast eth0 10.15.2.91
auto_failback off
watchdog /dev/watchdog
node localhost.localdomain
ping 10.15.2.50
respawn hacluster /usr/lib/heartbeat/ipfail
#apiauth ipfail gid=haclient uid=hacluster
apiauth ipfail gid=root uid=root
[root@localhost ha.d]# cat haresources
localhost.localdomain IPaddr::10.15.2.140/24/eth0:0 realserver ldirectord::ldirectord.cf
[root@localhost ha.d]# cat ldirectord.cf
#Global Directives
checktimeout=5
checkinterval=10
autoreload=yes
logfile="/var/log/ldirectord.log"
quiescent=no
virtual=10.15.2.140:3306
real=10.15.2.124:3306 gate
service=mysql
scheduler=rr
protocol=tcp
checkport=3306
checktype=connect
[root@localhost resource.d]# cat realserver
#!/bin/sh
#Description start lvs,disable arp response
VIP=10.15.2.140
RIP1=10.15.2.124
GW=10.15.2.50
case "$1" in
start)
echo "lvs start"
# set the Virtual IP Address
echo "1" >/proc/sys/net/ipv4/ip_forward
#Clear IPVS table
/sbin/ipvsadm -C
#set LVS
/sbin/ipvsadm -A -t $VIP:3306 -s rr
/sbin/ipvsadm -a -t $VIP:3306 -r $RIP1:3306 -g
/sbin/ipvsadm -a -t $VIP:3306 -r $RIP2:3306 -g
#Run LVS
/sbin/ipvsadm
/bin/touch /var/lock/subsys/lvs
# set Arp
# /sbin/arping -I eth0 -c 5 -s $VIP $GW >/dev/null 2
;;
stop)
/sbin/ipvsadm -C
/sbin/ipvsadm -Z
/bin/rm -rf /var/lock/subsys/lvs
# /sbin/arping -I eth0 -c 5 -s $VIP $GW
echo "ipvsadm STOPPED"
;;
status)
if [ ! -e /var/lock/subsys/lvs ];then
echo "ipvsadm is STOPPED"
exit 1
else
/sbin/ipvsadm -ln
echo "..........ipvsadm is OK"
fi
;;
*)
echo "Usage: $0{start|stop|status}"
exit 1
esac
exit 0
然后 执行 sh /etc/ha.d/resource.d/realserver start
[root@localhost resource.d]# sh /etc/ha.d/resource.d/realserver start
lvs start
illegal real server address[:port] specified
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddressort Scheduler Flags
-> RemoteAddressort Forward Weight ActiveConn InActConn
TCP 10.15.2.140:mysql rr
-> 10.15.2.124:mysql Route 1 0 0
[root@localhost resource.d]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:14:22:3E:F3:34
inet addr:10.15.2.91 Bcast:10.15.2.255 Mask:255.255.255.0
inet6 addr: fe80::214:22ff:fe3e:f334/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:917495 errors:0 dropped:0 overruns:0 frame:0
TX packets:136711 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:69050697 (65.8 MiB) TX bytes:17437426 (16.6 MiB)
Interrupt:169 Memory:fe8f0000-fe900000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:184043 errors:0 dropped:0 overruns:0 frame:0
TX packets:184043 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:49415893 (47.1 MiB) TX bytes:49415893 (47.1 MiB)------------------------------------没有虚拟ip 为什么??????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
请高手帮忙看看问题在哪里 多谢多谢!!!
ip add list命令来看看。。
[root@localhost ~]# ip add list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:14:22:3e:f3:34 brd ff:ff:ff:ff:ff:ff
inet 10.15.2.91/24 brd 10.15.2.255 scope global eth0
inet6 fe80::214:22ff:fe3e:f334/64 scope link
valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
自己顶一下 求高手帮忙
顶
自顶!!!!!!!!!!!!!!!
记得查看防火墙。。。
我只能建议你检查几个小问题,selinux的模式,还有是否开启ip转发!