心跳让我心痛

心跳让我心痛

我有 2 台 Ubuntu 11.04 VM,并在其上安装了 Heartbeat + apache2 以实现“高可用性”设置。Heartbeat 在两台虚拟机上都已启动并运行,但我无法 ping 虚拟 IP(集群 IP)

根据我遵循的指南,Heartbeat 应该自动在活动节点上创建别名。但我在两个虚拟机中都没有看到任何别名

设置如下:

在此处输入图片描述

ha-node1 配置:

root@ha-node1:/etc/ha.d# cat ha.cf
autojoin none
#mcast bond0 239.0.0.43 694 1 0
warntime 5
deadtime 15
initdead 60
keepalive 2
node ha-node1
node ha-node2
pacemaker respawn
logfile /var/log/ha-log
debugfile /var/log/ha-debug
udpport 694
auto_failback on
bcast eth0

root@ha-node1:/etc/ha.d# cat haresources
ha-node1 IPaddr::10.0.0.10 apache2

root@ha-node1:/etc/ha.d# crm_mon -1
============
Last updated: Thu Oct  6 17:42:57 2011
Stack: Heartbeat
Current DC: ha-node1 (710962f3-6239-4519-8ab7-b176af92cfe4) - partition with quorum
Version: 1.0.9-da7075976b5ff0bee71074385f8fd02f296ec8a3
2 Nodes configured, unknown expected votes
0 Resources configured.
============

Online: [ ha-node1 ha-node2 ]

root@ha-node1:/etc/ha.d# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0c:29:cb:ae:9d
          inet addr:10.0.0.8  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::20c:29ff:fecb:ae9d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25247 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17038 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:25278878 (25.2 MB)  TX bytes:2374181 (2.3 MB)
          Interrupt:19 Base address:0x2000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:480 (480.0 B)  TX bytes:480 (480.0 B)

root@ha-node1:/etc/ha.d# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:0c:29:cb:ae:9d brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.8/8 brd 10.255.255.255 scope global eth0
    inet6 fe80::20c:29ff:fecb:ae9d/64 scope link
       valid_lft forever preferred_lft forever

ha-node2 配置:

root@ha-node2:/etc/ha.d# cat ha.cf
autojoin none
#mcast bond0 239.0.0.43 694 1 0
warntime 5
deadtime 15
initdead 60
keepalive 2
node ha-node1
node ha-node2
pacemaker respawn
logfile /var/log/ha-log
debugfile /var/log/ha-debug
udpport 694
auto_failback on
bcast eth0

root@ha-node2:/etc/ha.d# cat haresources
ha-node1 IPaddr::10.0.0.10 apache2

root@ha-node2:/etc/ha.d# crm_mon -1
============
Last updated: Thu Oct  6 17:44:07 2011
Stack: Heartbeat
Current DC: ha-node1 (710962f3-6239-4519-8ab7-b176af92cfe4) - partition with quorum
Version: 1.0.9-da7075976b5ff0bee71074385f8fd02f296ec8a3
2 Nodes configured, unknown expected votes
0 Resources configured.
============

Online: [ ha-node1 ha-node2 ]

root@ha-node2:/etc/ha.d# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0c:29:d9:ca:5c
          inet addr:10.0.0.9  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::20c:29ff:fed9:ca5c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23310 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15397 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:25070323 (25.0 MB)  TX bytes:2044327 (2.0 MB)
          Interrupt:19 Base address:0x2000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:480 (480.0 B)  TX bytes:480 (480.0 B)

root@ha-node2:/etc/ha.d# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:0c:29:d9:ca:5c brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.9/8 brd 10.255.255.255 scope global eth0
    inet6 fe80::20c:29ff:fed9:ca5c/64 scope link
       valid_lft forever preferred_lft forever

crm_mon -1告诉我配置了 0 个资源。但我已IPaddr在 haresources 中明确添加了资源。我无法 ping 或浏览虚拟 IP。我在设置中做错了什么吗?

答案1

0 Resources configured表示故障转移 IP 是未配置作为 HA 资源。

顺便说一句,如果您只需要 IP 故障转移,那么 CARP(通过 ucarp/ucarpd)就简单得多。

相关内容