返回
编程
分类

被广泛使用的高可用集群系统

日期: 2020-01-02 07:59 浏览次数 : 59

Linux基于Heartbeat配置httpd高可用服务

Heartbeat是一个基于Linux开源的,被广泛使用的高可用集群系统。我们可以基于Heartbeat构建web高可用服务环境。本文在CentOS 6.5下做了一个简单示例,并对其日志进行了初步分析,供大家参考。

有关Heartbeat的相关知识,可以参考:

Heartbeat 集群组件概述

Heartbeat 安装及配置

一、配置host解析及网络
###主机名配置,与/etc/hosts中的解析两者配置保持一致
[[email protected] ~]# more /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=orasrv1.xlk.com

[[email protected] ~]# more /etc/hosts

127.0.0.1 localhost.localdomain localhost

#public ip
192.168.21.10 orasrv1.xlk.com orasrv1    ###node 1
192.168.21.13 orasrv2.xlk.com orasrv2    ###node 2

#private ip
192.168.144.128 orasrv1-priv.xlk.com orasrv1-priv
192.168.144.129 orasrv2-priv.xlk.com orasrv2-priv

[[email protected] ~]# scp /etc/hosts orasrv2:/etc/hosts

[[email protected] ~]# ifconfig |grep eth -A1
eth0      Link encap:Ethernet  HWaddr 00:0C:29:35:31:E5  #eth0对外提供服务
          inet addr:192.168.21.10  Bcast:192.168.21.255 

日志是我们跟踪系统和应用程序最好的方式,在Heartbeat中日志可以自定义输出位置,只需在ha.cf文件配置即可,具体可参见笔者的http://www.linuxidc.com/Linux/2011-11/48237.htm

Mask:255.255.255.0

eth1      Link encap:Ethernet  HWaddr 00:0C:29:35:31:EF  #eth1用作心跳网络
          inet addr:192.168.144.128  Bcast:192.168.144.255  Mask:255.255.255.0

二、配置等效性
###节点1
# ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ''
# ssh-copy-id -i ./.ssh/id_rsa.pub [email protected]
# ssh orasrv2 date;ssh 192.168.21.13 date;

###节点2
# ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ''
# ssh-copy-id -i ./.ssh/id_rsa.pub [email protected]
# ssh orasrv1 date;ssh 192.168.21.10 date;

三、配置时间同步
此处略。可以参考:配置Linux 11G R2 RAC NTP服务

四、安装httpd
节点1:orasrv1
    # yum install httpd
    # service httpd start  ###启动服务
    # echo "orasrv1.xlk.com" >>/var/www/html/index.html
    ###打开浏览器看看能否正常访问,
    ###如能正常访问,关闭服务,关闭自启动
    # service httpd stop
    # chkconfig httpd off

    节点2:orasrv2
    # yum install httpd
    # service httpd start  ###启动服务
    # echo "orasrv2.xlk.com" >>/var/www/html/index.html
    ###打开浏览器看看能否正常访问,
    ###如能正常访问,关闭服务,关闭自启动
    # service httpd stop
    # chkconfig httpd off 

五、配置heartbeat
1、配置认证方式
    [[email protected] ~]# vi /etc/ha.d/authkeys |grep -v ^#
    auth 1
    1 md5 74a6a503b5bec9373b22bb630608df41  ###使用md5验证

    [[email protected] ~]# chmod 600 /etc/ha.d/authkeys

2、配置ha.cf 
    [[email protected] ~]# vi /etc/ha.d/ha.cf
    logfile /var/log/ha-log
    keepalive      2
    deadtime        15
    warntime        10
    initdead        60
    udpport        694
    bcast          eth1
    auto_failback  off
    node orasrv1.xlk.com
    node orasrv2.xlk.com
    ping 192.168.21.254
    #respawn hacluster  /usr/lib64/heartbeat/ipfail

3、配置haresources
    [[email protected] ~]# vi /etc/ha.d/haresources
    orasrv1.xlk.com IPaddr::192.168.21.1/24/eth0 httpd

4、同步到第二节点 
    # scp -p /etc/ha.d/{ha.cf,authkeys,haresources} 192.168.21.13:/etc/ha.d/

六、验证测试
1、节点1启动heartbeat
###备注:本样例并未使用到共享文件系统,如配置drbd,或者nfs等。
[[email protected] ~]# service heartbeat start
Starting High-Availability services:
2015/11/06_11:46:51 INFO:  Resource is stopped ###此处提示资源处于停止状态
Done.

###以下为基于节点1上的日志分析
[[email protected] ~]# tail -fn 50 /var/log/ha-log
heartbeat[4373]: 2015/11/06_11:46:51 info: Version 2 support: false
heartbeat[4373]: 2015/11/06_11:46:51 WARN: Logging daemon is disabled --enabling logging daemon is recommended
heartbeat[4373]: 2015/11/06_11:46:51 info: **************************
heartbeat[4373]: 2015/11/06_11:46:51 info: Configuration validated. Starting heartbeat 2.1.4
heartbeat[4374]: 2015/11/06_11:46:51 info: heartbeat: version 2.1.4
heartbeat[4374]: 2015/11/06_11:46:52 info: Heartbeat generation: 1446714158
heartbeat[4374]: 2015/11/06_11:46:52 info: glib: UDP Broadcast heartbeat started on port 694 (694) interface eth0
heartbeat[4374]: 2015/11/06_11:46:52 info: glib: UDP Broadcast heartbeat closed on port 694 interface eth0 - Status: 1
heartbeat[4374]: 2015/11/06_11:46:52 info: glib: ping heartbeat started.
heartbeat[4374]: 2015/11/06_11:46:52 info: G_main_add_TriggerHandler: Added signal manual handler
heartbeat[4374]: 2015/11/06_11:46:52 info: G_main_add_TriggerHandler: Added signal manual handler
heartbeat[4374]: 2015/11/06_11:46:52 info: G_main_add_SignalHandler: Added signal handler for signal 17
heartbeat[4374]: 2015/11/06_11:46:52 info: Local status now set to: 'up'
heartbeat[4374]: 2015/11/06_11:46:52 info: Link 192.168.21.254:192.168.21.254 up.
heartbeat[4374]: 2015/11/06_11:46:52 info: Status update for node 192.168.21.254: status ping
heartbeat[4374]: 2015/11/06_11:46:52 info: Link orasrv1.xlk.com:eth0 up.
heartbeat[4374]: 2015/11/06_11:47:52 WARN: node orasrv2.xlk.com: is dead
###必威官网亚洲体育 ,上面的日志可以看出节点1上的heartbeat已经成功启动,此时尚未开始分配资源
###紧接着下面的提示节点2处于死亡状态,其时间间隔为60s(46:52s~47:52s),即我们配置文件中的initdead
###也就是说等待1分钟还没有探测到对方心跳,此时认为节点2死亡,注意,这里的死亡不等同于deadtime

###下面开始资源分配
heartbeat[4374]: 2015/11/06_11:47:52 info: Comm_now_up(): updating status to active
heartbeat[4374]: 2015/11/06_11:47:52 info: Local status now set to: 'active'
heartbeat[4374]: 2015/11/06_11:47:52 WARN: No STONITH device configured.
heartbeat[4374]: 2015/11/06_11:47:52 WARN: Shared disks are not protected.
heartbeat[4374]: 2015/11/06_11:47:52 info: Resources being acquired from orasrv2.xlk.com.
harc[4385]:    2015/11/06_11:47:52 info: Running /etc/ha.d/rc.d/status status
mach_down[4419]:        2015/11/06_11:47:52 info: /usr/share/heartbeat/mach_down: nice_failback: foreign resources acquired
mach_down[4419]:        2015/11/06_11:47:52 info: mach_down takeover complete for node orasrv2.xlk.com.
heartbeat[4374]: 2015/11/06_11:47:52 info: Initial resource acquisition complete (T_RESOURCES(us))
heartbeat[4374]: 2015/11/06_11:47:52 info: mach_down takeover complete.
IPaddr[4457]:  2015/11/06_11:47:52 INFO:  Resource is stopped
heartbeat[4386]: 2015/11/06_11:47:52 info: Local Resource acquisition completed.
harc[4518]:    2015/11/06_11:47:52 info: Running /etc/ha.d/rc.d/ip-request-resp ip-request-resp
ip-request-resp[4518]:  2015/11/06_11:47:52 received ip-request-resp IPaddr::192.168.21.1/24/eth0 OK yes
ResourceManager[4537]:  2015/11/06_11:47:52 info: Acquiring resource group: orasrv1.xlk.com IPaddr::192.168.21.1/24/eth0 httpd
IPaddr[4563]:  2015/11/06_11:47:52 INFO:  Resource is stopped ###上一条日志获取资源组,下一条日志启动资源
ResourceManager[4537]:  2015/11/06_11:47:52 info: Running /etc/ha.d/resource.d/IPaddr 192.168.21.1/24/eth0 start
IPaddr[4658]:  2015/11/06_11:47:53 INFO: Using calculated netmask for 192.168.21.1: 255.255.255.0
IPaddr[4658]:  2015/11/06_11:47:53 INFO: eval ifconfig eth0:0 192.168.21.1 netmask 255.255.255.0 broadcast 192.168.21.255
IPaddr[4629]:  2015/11/06_11:47:53 INFO:  Success ###vip 分配成功
ResourceManager[4537]:  2015/11/06_11:47:53 info: Running /etc/init.d/httpd  start ###开启httpd服务
heartbeat[4374]: 2015/11/06_11:48:03 info: Local Resource acquisition completed. (none)
heartbeat[4374]: 2015/11/06_11:48:03 info: local resource transition completed.

###验证VIP分配,如下,eth0:0上已获得VIP
[[email protected] ~]# ifconfig |grep eth -A1
eth0      Link encap:Ethernet  HWaddr 00:0C:29:35:31:E5 
          inet addr:192.168.21.10  Bcast:192.168.21.255 

相关阅读:

Mask:255.255.255.0

eth0:0    Link encap:Ethernet  HWaddr 00:0C:29:35:31:E5 
          inet addr:192.168.21.1  Bcast:192.168.21.255 

Linux高可用性方案之Heartbeat架构 http://www.linuxidc.com/Linux/2011-11/48240.htm

Mask:255.255.255.0

eth1      Link encap:Ethernet  HWaddr 00:0C:29:35:31:EF 
          inet addr:192.168.144.128  Bcast:192.168.144.255  Mask:255.255.255.0

###验证httpd服务,如下,此时透过VIP访问到主页,从orasrv1,即节点1返回数据

orasrv1.xlk.com

2、节点2启动heartbeat
[[email protected] ~]# service heartbeat start
Starting High-Availability services:
2015/11/06_11:50:22 INFO:  Resource is stopped
Done.

###下面的日志为节点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
[[email protected] ~]# 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
[[email protected] ~]# 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 

下面跟着笔者我们来看详细看下Heartbeat的日志
启动主机Heartbeat服务

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 

#/etc/init.d/heartbeat start
Heartbeat启动时,通过"tail -f /var/log/ messages"查看主节点系统日志信息,输出如下:
# tail -f /var/log/messages 
    Nov 26 07:52:21 node1 heartbeat: [3688]: info:
    Configuration validated. Starting heartbeat 2.0.8 
    Nov 26 07:52:21 node1 heartbeat: [3689]: info:
    heartbeat: version 2.0.8 
    Nov 26 07:52:21 node1 heartbeat: [3689]: info:
    Heartbeat generation: 3 
    Nov 26 07:52:21 node1 heartbeat: [3689]: info:
    G_main_add_TriggerHandler: Added signal manual handler 
    Nov 26 07:52:21 node1 heartbeat: [3689]: info:
    G_main_add_TriggerHandler: Added signal manual handler 
    Nov 26 07:52:21 node1 heartbeat: [3689]: info:
    glib: UDP Broadcast heartbeat started on port 694 (694) interface eth1 
    Nov 26 07:52:21 node1 heartbeat: [3689]: info:
    glib: UDP Broadcast heartbeat closed on port 694 interface eth1 - Status: 1 
    Nov 26 07:52:21 node1 heartbeat: [3689]: info:
    glib: ping heartbeat started. 
    Nov 26 07:52:21 node1 heartbeat: [3689]: info:
    G_main_add_SignalHandler: Added signal handler for signal 17 
    Nov 26 07:52:21 node1 heartbeat: [3689]: info:
    Local status now set to: 'up' 
    Nov 26 07:52:22 node1 heartbeat: [3689]: info:
    Link node1:eth1 up. 
    Nov 26 07:52:23 node1 heartbeat: [3689]: info:
    Link 192.168.60.1:192.168.60.1 up. 
    Nov 26 07:52:23 node1 heartbeat: [3689]: info:
    Status update for node 192.168.60.1: status ping
此段日志是Heartbeat在进行初始化配置,例如,Heartbeat的心跳时间间隔、UDP广播端口和ping节点的运行状态等,日志信息到这里会暂停,等待120秒之后,Heartbeat会继续输出日志,而这个120秒刚好是ha.cf中"initdead"选项的设定时间。此时Heartbeat的输出信息如下:
    Nov 26 07:54:22 node1 heartbeat: [3689]: WARN: node node2: is dead 
    Nov 26 07:54:22 node1 heartbeat: [3689]: info:
    Comm_now_up(): updating status to active 
    Nov 26 07:54:22 node1 heartbeat: [3689]: info:
    Local status now set to: 'active' 
    Nov 26 07:54:22 node1 heartbeat: [3689]: info:
    Starting child client "/usr/lib/heartbeat/ipfail" (694,694) 
    Nov 26 07:54:22 node1 heartbeat: [3689]: WARN:
    No STONITH device configured. 
    Nov 26 07:54:22 node1 heartbeat: [3689]: WARN:
    Shared disks are not protected. 
    Nov 26 07:54:22 node1 heartbeat: [3689]: info:
    Resources being acquired from node2. 
    Nov 26 07:54:22 node1 heartbeat: [3712]: info:
    Starting "/usr/lib/heartbeat/ipfail" as uid 694  gid 694 (pid 3712)

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
[[email protected] ~]# /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节点均处于活动状态

###下面是开启hb_standby之后输出的日志信息,所有的资源被节点1接管
heartbeat[5115]: 2015/11/06_11:56:06 info: orasrv2.xlk.com wants to go standby [all]
heartbeat[5115]: 2015/11/06_11:56:06 info: standby: acquire [all] resources from orasrv2.xlk.com
heartbeat[5143]: 2015/11/06_11:56:06 info: acquire all HA resources (standby).
ResourceManager[5156]:  2015/11/06_11:56:06 info: Acquiring resource group: orasrv1.xlk.com IPaddr::192.168.21.1/24/eth0 httpd
IPaddr[5182]:  2015/11/06_11:56:06 INFO:  Resource is stopped
ResourceManager[5156]:  2015/11/06_11:56:06 info: Running /etc/ha.d/resource.d/IPaddr 192.168.21.1/24/eth0 start
IPaddr[5277]:  2015/11/06_11:56:06 INFO: Using calculated netmask for 192.168.21.1: 255.255.255.0
IPaddr[5277]:  2015/11/06_11:56:06 INFO: eval ifconfig eth0:0 192.168.21.1 netmask 255.255.255.0 broadcast 192.168.21.255
IPaddr[5248]:  2015/11/06_11:56:06 INFO:  Success
ResourceManager[5156]:  2015/11/06_11:56:06 info: Running /etc/init.d/httpd  start
heartbeat[5143]: 2015/11/06_11:56:07 info: all HA resource acquisition completed (standby).
heartbeat[5115]: 2015/11/06_11:56:07 info: Standby resource acquisition done [all].
heartbeat[5115]: 2015/11/06_11:56:07 info: remote resource transition completed.

七、小结
a、对于集群上节点之间的切换实质上是资源的接管,通常包括VIP分配回收,磁盘卸载挂载,以及服务的启停等。
b、对于备用节点,其相应的共享磁盘(非严格意义上)不可读写,服务处于停止状态。

基于Heartbeat V1实现Web服务双机热备

Heartbeat实现Web服务的高可用群集

Heartbeat+LVS+Ldirectord高可用负载均衡解决方案

DRBD+Heartbeat+NFS高可用性配置笔记

Heartbeat基于CRM使用NFS对MySQL高可用

Heartbeat高可用httpd基于Resources简单配置

CentOS 6 高可用服务 Heartbeat v3 安装以及配置 

本文永久更新链接地址:

Heartbeat是一个基于Linux开源的,被广泛使用的高可用集群系统。我们可以基于Heartbeat构建web高可用服务环...

在上面这段日志中,由于node2还没有启动,因此会给出"node2: is dead"的警告信息,接下来启动了Heartbeat插件ipfail。由于我们在ha.cf文件中没有配置STONITH,因此日志里也给出了"No STONITH device configured"的警告提示。
继续看下面的日志:
    Nov 26 07:54:23 node1 harc[3713]: info: Running /etc/ha.d/rc.d/status status 
    Nov 26 07:54:23 node1 mach_down[3735]: info: /usr/lib/
    heartbeat/mach_down: nice_failback: foreign resources acquired 
    Nov 26 07:54:23 node1 mach_down[3735]: info: mach_down
    takeover complete for node node2. 
    Nov 26 07:54:23 node1 heartbeat: [3689]: info: mach_down takeover complete. 
    Nov 26 07:54:23 node1 heartbeat: [3689]: info: Initial
    resource acquisition complete (mach_down) 
    Nov 26 07:54:24 node1 IPaddr[3768]: INFO:  Resource is stopped 
    Nov 26 07:54:24 node1 heartbeat: [3714]: info: Local Resource
    acquisition completed. 
    Nov 26 07:54:24 node1 harc[3815]: info: Running /etc/ha.
    d/rc.d/ip-request-resp ip-request-resp 
    Nov 26 07:54:24 node1 ip-request-resp[3815]: received ip-
    request-resp 192.168.60.200/24/eth0 OK yes 
    Nov 26 07:54:24 node1 ResourceManager[3830]: info: Acquiring
    resource group: node1 192.168.60.200/24/eth0 Filesystem:
    :/dev/sdb5::/webdata::ext3 
    Nov 26 07:54:24 node1 IPaddr[3854]: INFO:  Resource is stopped 
    Nov 26 07:54:25 node1 ResourceManager[3830]: info: Running
    /etc/ha.d/resource.d/IPaddr 192.168.60.200/24/eth0 start 
    Nov 26 07:54:25 node1 IPaddr[3932]: INFO: Using calculated
    netmask for 192.168.60.200: 255.255.255.0 
    Nov 26 07:54:25 node1 IPaddr[3932]: DEBUG: Using calculated
    broadcast for 192.168.60.200: 192.168.60.255 
    Nov 26 07:54:25 node1 IPaddr[3932]: INFO: eval /sbin/ifconfig
    eth0:0 192.168.60.200 netmask 255.255.255.0 broadcast 192.168.60.255 
    Nov 26 07:54:25 node1 avahi-daemon[1854]: Registering new
    address record for 192.168.60.200 on eth0. 
    Nov 26 07:54:25 node1 IPaddr[3932]: DEBUG: Sending Gratuitous
    Arp for 192.168.60.200 on eth0:0 [eth0] 
    Nov 26 07:54:26 node1 IPaddr[3911]: INFO:  Success 
    Nov 26 07:54:26 node1 Filesystem[4021]: INFO:  Resource is stopped 
    Nov 26 07:54:26 node1 ResourceManager[3830]: info: Running
    /etc/ha.d/resource.d/ Filesystem/dev/sdb5 /webdata ext3 start 
    Nov 26 07:54:26 node1 Filesystem[4062]: INFO: Running start
    for /dev/sdb5 on /webdata 
    Nov 26 07:54:26 node1 kernel: kjournald starting.  Commit interval 5 seconds 
    Nov 26 07:54:26 node1 kernel: EXT3 FS on sdb5, internal journal 
    Nov 26 07:54:26 node1 kernel: EXT3-fs: mounted
    filesystem with ordered data mode. 
    Nov 26 07:54:26 node1 Filesystem[4059]: INFO:
    Success 
    Nov 26 07:54:33 node1 heartbeat: [3689]: info:
    Local Resource acquisition completed. (none) 
    Nov 26 07:54:33 node1 heartbeat: [3689]: info:
    local resource transition completed
上面这段日志是进行资源的监控和接管,主要完成haresources文件中的设置,在这里是启用集群虚拟IP和挂载磁盘分区。
此时,通过ifconfig命令查看主节点的网络配置,可以看到,主节点已经自动绑定集群IP地址,在HA集群之外的主机上通过ping命令检测集群IP地址192.168.60.200,已经处于可通状态,也就是该地址变得可用。
同时查看磁盘分区的挂载情况,共享磁盘分区/dev/sdb5已经被自动挂载。

必威官网亚洲体育 1