测试Heartbeat的HA功能
一、启动Heartbeat
1、启动主节点的Heartbeat Heartbeat安装完成后,自动在/etc/init.d目录下生成了启动脚步文件heartbeat,直接输入/etc/init.d/heartbeat可以看到heartbeat脚本的用法,如下所示: [root@node1 ~]# /etc/init.d/heartbeat Usage: /etc/init.d/heartbeat {start|stop|status|restart|reload|force-reload} 因而启动heartbeat可以通过如下命令进行: [root@node1 ~]#service heartbeat start 或者通过 [root@node1 ~]#/etc/init.d/heartbeat start 这样就启动了主节点的heartbeat服务 日志信息如下: Feb 5 19:09:48 node1 heartbeat: [22768]: info: glib: ucast: bound send socket to device: eth0 Feb 5 19:09:48 node1 heartbeat: [22768]: info: glib: ucast: bound receive socket to device: eth0 Feb 5 19:09:48 node1 heartbeat: [22768]: info: glib: ucast: started on port 694 interface eth0 to 192.168.12.1 Feb 5 19:09:48 node1 heartbeat: [22768]: info: glib: ping heartbeat started. Feb 5 19:09:48 node1 heartbeat: [22768]: info: glib: ping group heartbeat started. Feb 5 19:09:48 node1 heartbeat: [22768]: info: Local status now set to: 'up' Feb 5 19:09:49 node1 heartbeat: [22768]: info: Link 192.168.12.1:192.168.12.1 up. Feb 5 19:09:49 node1 heartbeat: [22768]: info: Status update for node 192.168.12.1: status ping Feb 5 19:09:49 node1 heartbeat: [22768]: info: Link group1:group1 up. Feb 5 19:09:49 node1 heartbeat: [22768]: info: Status update for node group1: status ping 此段日志是Heartbeat在进行初始化配置,例如,heartbeat的心跳时间间隔、UDP广播端口、ping节点的运行状态等,日志信息到这里会暂停,等待120秒之后,heartbeat会继续输出日志,而这个120秒刚好是ha.cf中“initdead”选项的设定时间。此时heartbeat的输出信息如下: Feb 5 19:11:48 node1 heartbeat: [22768]: WARN: node node2: is dead Feb 5 19:11:48 node1 heartbeat: [22768]: info: Comm_now_up(): updating status to active Feb 5 19:11:48 node1 heartbeat: [22768]: info: Local status now set to: 'active' Feb 5 19:11:48 node1 heartbeat: [22768]: info: Starting child client "/usr/local/ha/lib/heartbeat/pingd -m 100 -d 5s" (102,105) Feb 5 19:11:49 node1 heartbeat: [22768]: WARN: No STONITH device configured. Feb 5 19:11:49 node1 heartbeat: [22768]: WARN: Shared disks are not protected. Feb 5 19:11:49 node1 heartbeat: [22768]: info: Resources being acquired from node2. Feb 5 19:11:49 node1 heartbeat: [22794]: info: Starting "/usr/local/ha/lib/heartbeat/pingd -m 100 -d 5s" as uid 102 gid 105 (pid 22794) 在上面这段日志中,由于node2还没有启动,所以会给出“node2: is dead”的警告信息,接下来启动了heartbeat插件pingd,由于我们在ha.cf文件中没有配置STONITH,所以日志里也给出了“No STONITH device configured”的警告提示。
(编辑:佛山站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |