免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2009 | 回复: 2
打印 上一主题 下一主题

heartbeat+apache切换到slave时通过VIP无法时无法访问web服务 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-05-25 22:57 |只看该作者 |倒序浏览
本帖最后由 7343696 于 2010-05-25 23:00 编辑

heartbeat+apache切换到slave时,通过VIP无法马上访问web服务,切换时slave上面的apache服务已经自动启动,并且通过slave 真实的ip能够访问web服务,大概要5分钟以后通过VIP才能访问web服务,但是真实IP一直能访问,并且master主机恢复过也会自动切换到master上面,在master上面通过也要经过几分钟后才能通过VIP访问web服务。
环境是oracle linux 5.4
下面是配置,两台主机配置一样。
[root@ha1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.11.22           ha2.huang.com   ha2
192.168.28.22           ha2.huang.com   ha2
192.168.11.21           ha1.huang.com   ha1
192.168.28.22           ha2.huang.com   ha2

[root@ha1 ~]# gerp -v # /etc/ha.d/
authkeys       harc           rc.d/          resource.d/   
ha.cf          haresources    README.config  shellfuncs     
[root@ha1 ~]# gerp -v # /etc/ha.d/ha.cf
-bash: gerp: command not found
[root@ha1 ~]# grep -v # /etc/ha.d/ha.cf
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
[root@ha1 ~]# grep -v ^# /etc/ha.d/ha.cf
logfile /var/log/ha-log
logfacility     local0
keepalive 2
deadtime 5
warntime 10
initdead 120

udpport 694
baud    19200
bcast   eth2            # Linux
mcast eth2 225.0.0.1 694 1 0
ucast eth2 192.168.28.22
auto_failback on
watchdog /dev/watchdog
node    ha1.huang.com
node    ha2.huang.com
ping_group group1 192.168.11.21 192.168.11.22
respawn root /usr/lib/heartbeat/ipfail
apiauth ipfail gid=root uid=root
[root@ha1 ~]# grep -v ^# /etc/ha.d/haresources
ha1.huang.com IPaddr::192.168.11.253/24/eth2 httpd
[root@ha1 ~]# grep -v ^# /etc/ha.d/authkeys
auth 1
1 crc




下面是切换到slave时的状态

[root@ha2 ~]# ps axu|grep httpd
root     11381  0.1  1.1   9944  2892 ?        Ss   05:17   0:00 /usr/sbin/httpd
apache   11382  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11384  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11385  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11386  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11388  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11390  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11392  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11393  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
root     11395  0.0  0.2   3924   708 pts/1    S+   05:18   0:00 grep httpd
[root@ha2 ~]# ps axu|grep httpd
root     11381  0.1  1.1   9944  2892 ?        Ss   05:17   0:00 /usr/sbin/httpd
apache   11382  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11384  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11385  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11386  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11388  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11390  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11392  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
apache   11393  0.0  0.8   9944  2072 ?        S    05:17   0:00 /usr/sbin/httpd
root     11397  0.0  0.2   3924   704 pts/1    R+   05:18   0:00 grep httpd
[root@ha1 ~]# ifconfig|grep addr
eth0      Link encap:Ethernet  HWaddr 00:0C:29:CB:8E:22  
          inet addr:192.168.0.14  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fecb:8e22/64 Scope:Link
          Interrupt:177 Base address:0x1400
eth1      Link encap:Ethernet  HWaddr 00:0C:29:CB:8E:2C  
          inet addr:192.168.11.21  Bcast:192.168.11.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fecb:8e2c/64 Scope:Link
          Interrupt:185 Base address:0x1480
eth2      Link encap:Ethernet  HWaddr 00:0C:29:CB:8E:36  
          inet addr:192.168.28.21  Bcast:192.168.28.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fecb:8e36/64 Scope:Link
          Interrupt:193 Base address:0x1800
eth2:0    Link encap:Ethernet  HWaddr 00:0C:29:CB:8E:36  
          inet addr:192.168.11.253  Bcast:192.168.11.255  Mask:255.255.255.0
          Interrupt:193 Base address:0x1800
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host

论坛徽章:
0
2 [报告]
发表于 2010-05-25 23:05 |只看该作者
logfile /var/log/ha-log

把从节点的日志帖上来。

论坛徽章:
0
3 [报告]
发表于 2010-05-25 23:16 |只看该作者
谢谢了,已经解决了。出在
[root@ha2 ~]# tail -1 /etc/ha.d/haresources
ha1.huang.com IPaddr::192.168.28.253/24/eth2 httpd

我原来的文件是
ha1.huang.com IPaddr::192.168.11.253/24/eth2 httpd
192.168.11.253这个ip段是eth1的。
所以导致要几分钟后才能通过VIP访问。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP