###下面的日志为节点1,继续跟踪节点1的日志
###从下面的日志可以得知orasrv2.xlk.com: status up以及remote resource transition completed
heartbeat[4374]: 2015/11/06_11:50:23 info: Link orasrv2.xlk.com:eth0 up.
heartbeat[4374]: 2015/11/06_11:50:23 info: Status update for node orasrv2.xlk.com: status init
heartbeat[4374]: 2015/11/06_11:50:23 info: Status update for node orasrv2.xlk.com: status up
harc[4809]: 2015/11/06_11:50:23 info: Running /etc/ha.d/rc.d/status status
harc[4825]: 2015/11/06_11:50:23 info: Running /etc/ha.d/rc.d/status status
heartbeat[4374]: 2015/11/06_11:50:25 info: Status update for node orasrv2.xlk.com: status active
harc[4840]: 2015/11/06_11:50:25 info: Running /etc/ha.d/rc.d/status status
heartbeat[4374]: 2015/11/06_11:50:25 info: remote resource transition completed.
3、节点1停止heartbeat
###通过下面的命令来停止节点1上的heartbeat
[root@orasrv1 ~]# service heartbeat stop
Stopping High-Availability services:
Done.
###此时继续观察节点1的日志变化情况
heartbeat[4374]: 2015/11/06_11:53:13 info: Heartbeat shutdown in progress. (4374)
heartbeat[4873]: 2015/11/06_11:53:13 info: Giving up all HA resources. ###节点1开始放弃资源
ResourceManager[4886]: 2015/11/06_11:53:14 info: Releasing resource group: orasrv1.xlk.com IPaddr::192.168.21.1/24/eth0 httpd
ResourceManager[4886]: 2015/11/06_11:53:14 info: Running /etc/init.d/httpd stop ###停止httpd服务
ResourceManager[4886]: 2015/11/06_11:53:14 info: Running /etc/ha.d/resource.d/IPaddr 192.168.21.1/24/eth0 stop
IPaddr[4975]: 2015/11/06_11:53:14 INFO: ifconfig eth0:0 down
IPaddr[4946]: 2015/11/06_11:53:14 INFO: Success
heartbeat[4873]: 2015/11/06_11:53:14 info: All HA resources relinquished.
###所有的HA资源在节点1放弃完毕,下面开始kill heartbeat相关进程
heartbeat[4374]: 2015/11/06_11:53:15 WARN: 1 lost packet(s) for [orasrv2.xlk.com] [95:97]
heartbeat[4374]: 2015/11/06_11:53:15 info: No pkts missing from orasrv2.xlk.com!
heartbeat[4374]: 2015/11/06_11:53:16 info: killing HBREAD process 4381 with signal 15
heartbeat[4374]: 2015/11/06_11:53:16 info: killing HBFIFO process 4377 with signal 15
heartbeat[4374]: 2015/11/06_11:53:16 info: killing HBWRITE process 4378 with signal 15
heartbeat[4374]: 2015/11/06_11:53:16 info: killing HBREAD process 4379 with signal 15
heartbeat[4374]: 2015/11/06_11:53:16 info: killing HBWRITE process 4380 with signal 15
heartbeat[4374]: 2015/11/06_11:53:16 info: Core process 4378 exited. 5 remaining
heartbeat[4374]: 2015/11/06_11:53:16 info: Core process 4379 exited. 4 remaining
heartbeat[4374]: 2015/11/06_11:53:16 info: Core process 4381 exited. 3 remaining
heartbeat[4374]: 2015/11/06_11:53:16 info: Core process 4377 exited. 2 remaining
heartbeat[4374]: 2015/11/06_11:53:16 info: Core process 4380 exited. 1 remaining
heartbeat[4374]: 2015/11/06_11:53:16 info: orasrv1.xlk.com Heartbeat shutdown complete.
###观察节点2,此时也获取VIP
[root@orasrv2 ~]# ifconfig |grep eth -A1
eth0 Link encap:Ethernet HWaddr 00:0C:29:F1:2E:E4 #Author : Leshami
inet addr:192.168.21.13 Bcast:192.168.21.255 Mask:255.255.255.0
--
eth0:0 Link encap:Ethernet HWaddr 00:0C:29:F1:2E:E4 #Blog :
inet addr:192.168.21.1 Bcast:192.168.21.255 Mask:255.255.255.0
--
eth1 Link encap:Ethernet HWaddr 00:0C:29:F1:2E:EE
inet addr:192.168.144.129 Bcast:192.168.144.255 Mask:255.255.255.0
###验证httpd服务,如下,此时透过VIP访问到主页,从orasrv2,即节点2返回数据
orasrv2.xlk.com
4、使用hb_standby切换
###下面通过hb_standby将服务切换回节点1,切换前启动节点1上的heartbeat
[root@orasrv2 ~]# /usr/share/heartbeat/hb_standby
2015/11/06_11:56:05 Going standby [all].
###继续跟踪节点1的日志
heartbeat[5114]: 2015/11/06_11:55:23 info: Version 2 support: false
heartbeat[5114]: 2015/11/06_11:55:23 WARN: Logging daemon is disabled --enabling logging daemon is recommended
heartbeat[5114]: 2015/11/06_11:55:23 info: **************************
heartbeat[5114]: 2015/11/06_11:55:23 info: Configuration validated. Starting heartbeat 2.1.4
heartbeat[5115]: 2015/11/06_11:55:23 info: heartbeat: version 2.1.4
heartbeat[5115]: 2015/11/06_11:55:23 info: Heartbeat generation: 1446714159
heartbeat[5115]: 2015/11/06_11:55:23 info: glib: UDP Broadcast heartbeat started on port 694 (694) interface eth0
heartbeat[5115]: 2015/11/06_11:55:23 info: glib: UDP Broadcast heartbeat closed on port 694 interface eth0 - Status: 1
heartbeat[5115]: 2015/11/06_11:55:23 info: glib: ping heartbeat started.
heartbeat[5115]: 2015/11/06_11:55:23 info: G_main_add_TriggerHandler: Added signal manual handler
heartbeat[5115]: 2015/11/06_11:55:23 info: G_main_add_TriggerHandler: Added signal manual handler
heartbeat[5115]: 2015/11/06_11:55:23 info: G_main_add_SignalHandler: Added signal handler for signal 17
heartbeat[5115]: 2015/11/06_11:55:23 info: Local status now set to: 'up'
heartbeat[5115]: 2015/11/06_11:55:23 info: Link 192.168.21.254:192.168.21.254 up.
heartbeat[5115]: 2015/11/06_11:55:23 info: Status update for node 192.168.21.254: status ping
heartbeat[5115]: 2015/11/06_11:55:23 info: Link orasrv1.xlk.com:eth0 up.
heartbeat[5115]: 2015/11/06_11:55:25 info: Link orasrv2.xlk.com:eth0 up.
heartbeat[5115]: 2015/11/06_11:55:25 info: Status update for node orasrv2.xlk.com: status active
harc[5124]: 2015/11/06_11:55:25 info: Running /etc/ha.d/rc.d/status status
heartbeat[5115]: 2015/11/06_11:55:25 info: Comm_now_up(): updating status to active
heartbeat[5115]: 2015/11/06_11:55:25 info: Local status now set to: 'active'
heartbeat[5115]: 2015/11/06_11:55:26 info: remote resource transition completed.
heartbeat[5115]: 2015/11/06_11:55:26 info: remote resource transition completed.
heartbeat[5115]: 2015/11/06_11:55:26 info: Local Resource acquisition completed. (none)
heartbeat[5115]: 2015/11/06_11:55:26 info: Initial resource acquisition complete (T_RESOURCES(them))
###上面的日志表面,此时节点1已经启动完毕,并且2节点均处于活动状态