- 论坛徽章:
- 0
|
本帖最后由 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 |
|