Centos6.5配置HA集群

Centos6.5配置HA集群

我需要使用 2 台计算机配置 HA 集群。但我遇到了一个问题,当我尝试启动心跳服务时,它启动了但抛出了错误。以下是错误消息:

Starting High-Availability services: ERROR: Cannot locate resource script IPaddr
/usr/share/heartbeat/ResourceManager: line 209: 192.168.1.199: command not found
Done.

日志文件中的输出:

Oct  3 20:00:46 localhost heartbeat: [6213]: info: Pacemaker support: false
Oct  3 20:00:46 localhost heartbeat: [6213]: WARN: Logging daemon is disabled --enabling logging daemon is recommended
Oct  3 20:00:46 localhost heartbeat: [6213]: info: **************************
Oct  3 20:00:46 localhost heartbeat: [6213]: info: Configuration validated. Starting heartbeat 3.0.4
Oct  3 20:00:46 localhost heartbeat: [6214]: info: heartbeat: version 3.0.4
Oct  3 20:00:46 localhost heartbeat: [6214]: info: Heartbeat generation: 1411938913
Oct  3 20:00:46 localhost heartbeat: [6214]: info: glib: ucast: write socket priority set to IPTOS_LOWDELAY on eth0
Oct  3 20:00:46 localhost heartbeat: [6214]: info: glib: ucast: bound send socket to device: eth0
Oct  3 20:00:46 localhost heartbeat: [6214]: info: glib: ucast: set SO_REUSEPORT(w)
Oct  3 20:00:46 localhost heartbeat: [6214]: info: glib: ucast: bound receive socket to device: eth0
Oct  3 20:00:46 localhost heartbeat: [6214]: info: glib: ucast: set SO_REUSEPORT(w)
Oct  3 20:00:46 localhost heartbeat: [6214]: info: glib: ucast: started on port 694 interface eth0 to 192.168.1.145
Oct  3 20:00:46 localhost heartbeat: [6214]: info: G_main_add_TriggerHandler: Added signal manual handler
Oct  3 20:00:46 localhost heartbeat: [6214]: info: G_main_add_TriggerHandler: Added signal manual handler
Oct  3 20:00:46 localhost heartbeat: [6214]: info: G_main_add_SignalHandler: Added signal handler for signal 17
Oct  3 20:00:46 localhost heartbeat: [6214]: info: Local status now set to: 'up'
Oct  3 20:00:52 localhost heartbeat: [6214]: info: Link srv2:eth0 up.
Oct  3 20:00:52 localhost heartbeat: [6214]: info: Status update for node srv2: status up
Oct  3 20:00:52 localhost heartbeat: [6224]: ERROR: cannot exec /etc/ha.d//harc
Oct  3 20:00:53 localhost heartbeat: [6214]: info: Comm_now_up(): updating status to active
Oct  3 20:00:53 localhost heartbeat: [6214]: info: Local status now set to: 'active'
Oct  3 20:00:53 localhost heartbeat: [6214]: info: Status update for node srv2: status active
Oct  3 20:00:53 localhost heartbeat: [6228]: ERROR: cannot exec /etc/ha.d//harc
Oct  3 20:01:04 localhost heartbeat: [6214]: info: remote resource transition completed.
Oct  3 20:01:04 localhost heartbeat: [6214]: info: remote resource transition completed.
Oct  3 20:01:04 localhost heartbeat: [6214]: info: Initial resource acquisition complete (T_RESOURCES(us))
Oct  3 20:01:04 localhost ResourceManager(default)[6248]: ERROR: Cannot locate resource script IPaddr
Oct  3 20:01:04 localhost heartbeat: [6214]: WARN: 1 lost packet(s) for [srv2] [22:24]
Oct  3 20:01:04 localhost heartbeat: [6214]: info: No pkts missing from srv2!
Oct  3 20:01:04 localhost heartbeat: [6214]: info: remote resource transition completed.
Oct  3 20:01:04 localhost heartbeat: [6229]: info: Local Resource acquisition completed.
Oct  3 20:01:05 localhost heartbeat: [6273]: ERROR: cannot exec /etc/ha.d//harc

这是心跳的配置。Comp1 和 Comp2 /etc/ha.d/authkeys

auth 3
3 md5 37a747287238744a7bef7e9d52a53494

组件1 /etc/ha.d/ha.cf

logfacility local0
keepalive 1
deadtime 10
ucast eth0 192.168.1.145
auto_failback off
node srv1
node srv2

计算机2 /etc/ha.d/ha.cf

logfacility local0
keepalive 1
deadtime 10
ucast eth0 192.168.1.146
auto_failback off
node srv1
node srv2

Comp1 和 Comp2 /etc/ha.d/haresources

srv1 192.168.1.199 httpd

HA集群结构:

同伴1:

主机名-srv1

IP-192.168.1.146

虚拟 IP - 192.168.1.199

同伴2:

主机名-srv2

IP-192.168.1.145

我做错了什么?请帮忙。谢谢!

答案1

检查相应变量是否/etc/ha.d/shellfuncs设置正确:

: ${HA_DIR=/etc/ha.d}
: ${HA_RESOURCEDIR=$HA_DIR/resource.d}

并验证/etc/init.d/heartbeat

. $HA_DIR/shellfuncs

答案2

尝试

srv1 IPaddr::192.168.1.199/24/eth0 httpd

代替

srv1 192.168.1.199 httpd

相关内容