两台设备均安装heartbeat和libnet:
[root@master ha.d]# yum list |grep heartbeat
heartbeat.x86_64 3.0.4-2.el6 epel
heartbeat-devel.i686 3.0.4-2.el6 epel
heartbeat-devel.x86_64 3.0.4-2.el6 epel
heartbeat-libs.i686 3.0.4-2.el6 epel
heartbeat-libs.x86_64 3.0.4-2.el6 epel
[root@master ha.d]# yum list |grep libnet
libnet.x86_64 1.1.6-7.el6 @epel
libnet.i686 1.1.6-7.el6 epel
libnet-devel.i686 1.1.6-7.el6 epel
libnet-devel.x86_64 1.1.6-7.el6 epel
libnet10.i686 1.0.2a-18.el6 epel
libnet10.x86_64 1.0.2a-18.el6 epel
libnet10-devel.i686 1.0.2a-18.el6 epel
libnet10-devel.x86_64 1.0.2a-18.el6 epel
libnetfilter_acct.i686 1.0.2-1.el6 epel
libnetfilter_acct.x86_64 1.0.2-1.el6 epel
libnetfilter_acct-devel.i686 1.0.2-1.el6 epel
libnetfilter_acct-devel.x86_64 1.0.2-1.el6 epel
libnetfilter_conntrack.i686 0.0.100-2.el6 base
libnetfilter_conntrack.x86_64 0.0.100-2.el6 base
libnetfilter_conntrack-devel.i686 0.0.100-2.el6 base
libnetfilter_conntrack-devel.x86_64 0.0.100-2.el6 base
libnetfilter_cthelper.i686 1.0.0-3.el6 epel
libnetfilter_cthelper.x86_64 1.0.0-3.el6 epel
libnetfilter_cthelper-devel.i686 1.0.0-3.el6 epel
libnetfilter_cthelper-devel.x86_64 1.0.0-3.el6 epel
libnetfilter_log.i686 1.0.1-7.el6 epel
libnetfilter_log.x86_64 1.0.1-7.el6 epel
libnetfilter_log-devel.i686 1.0.1-7.el6 epel
libnetfilter_log-devel.x86_64 1.0.1-7.el6 epel
libnetfilter_queue.i686 1.0.1-3.el6 base
libnetfilter_queue.x86_64 1.0.2-3.el6.art atomic
libnetfilter_queue-devel.i686 1.0.1-3.el6 base
libnetfilter_queue-devel.x86_64 1.0.2-3.el6.art atomic
[root@slave ha.d]# yum list |grep heartbeat
heartbeat.x86_64 3.0.4-2.el6 epel
heartbeat-devel.i686 3.0.4-2.el6 epel
heartbeat-devel.x86_64 3.0.4-2.el6 epel
heartbeat-libs.i686 3.0.4-2.el6 epel
heartbeat-libs.x86_64 3.0.4-2.el6 epel
[root@slave ha.d]# yum list |grep libnet
libnet.x86_64 1.1.6-7.el6 @epel
libnet.i686 1.1.6-7.el6 epel
libnet-devel.i686 1.1.6-7.el6 epel
libnet-devel.x86_64 1.1.6-7.el6 epel
libnet10.i686 1.0.2a-18.el6 epel
libnet10.x86_64 1.0.2a-18.el6 epel
libnet10-devel.i686 1.0.2a-18.el6 epel
libnet10-devel.x86_64 1.0.2a-18.el6 epel
libnetfilter_acct.i686 1.0.2-1.el6 epel
libnetfilter_acct.x86_64 1.0.2-1.el6 epel
libnetfilter_acct-devel.i686 1.0.2-1.el6 epel
libnetfilter_acct-devel.x86_64 1.0.2-1.el6 epel
libnetfilter_conntrack.i686 0.0.100-2.el6 base
libnetfilter_conntrack.x86_64 0.0.100-2.el6 base
libnetfilter_conntrack-devel.i686 0.0.100-2.el6 base
libnetfilter_conntrack-devel.x86_64 0.0.100-2.el6 base
libnetfilter_cthelper.i686 1.0.0-3.el6 epel
libnetfilter_cthelper.x86_64 1.0.0-3.el6 epel
libnetfilter_cthelper-devel.i686 1.0.0-3.el6 epel
libnetfilter_cthelper-devel.x86_64 1.0.0-3.el6 epel
libnetfilter_log.i686 1.0.1-7.el6 epel
libnetfilter_log.x86_64 1.0.1-7.el6 epel
libnetfilter_log-devel.i686 1.0.1-7.el6 epel
libnetfilter_log-devel.x86_64 1.0.1-7.el6 epel
libnetfilter_queue.i686 1.0.1-3.el6 base
libnetfilter_queue.x86_64 1.0.2-3.el6.art atomic
libnetfilter_queue-devel.i686 1.0.1-3.el6 base
libnetfilter_queue-devel.x86_64 1.0.2-3.el6.art atomic
[root@master doc]# cd /usr/share/doc/heartbeat-3.0.4/
[root@master heartbeat-3.0.4]# cp authkeys ha.cf haresources /etc/ha.d/
authkeys设置验证方式:
[root@master heartbeat-3.0.4]# vim authkeys
auth 3
#1 crc
#2 sha1 HI!
3 md5 Hello!
[root@master heartbeat-3.0.4]# chmod 600 authkeys
配置VIP:
[root@master heartbeat-3.0.4]# vim haresources
master 192.168.0.110/24/eth0:0 nginx
配置ha.cf:
[root@master heartbeat-3.0.4]# vim ha.cf
[root@master heartbeat-3.0.4]# >ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 60
udpport 694
ucast eth0 192.168.0.11
auto_failback on
node master
node slave
ping 192.168.0.1
respawn hacluster /usr/lib/heartbeat/ipfail
[root@master heartbeat-3.0.4]# scp authkeys haresources ha.cf slave:/etc/ha.d/
[root@slave ha.d]# vim ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 60
udpport 694
ucast eth0 192.168.0.10
auto_failback on
node master
node slave
ping 192.168.0.1
respawn hacluster /usr/lib/heartbeat/ipfail
主从设备启动heartbeat报错:
[root@master heartbeat-3.0.4]# /etc/init.d/heartbeat start
Starting High-Availability services: Heartbeat failure [rc=6]. Failed.
heartbeat[3707]: 2016/12/29_04:24:05 ERROR: Bad permissions on keyfile [/etc/ha.d//authkeys], 600 recommended.
heartbeat[3707]: 2016/12/29_04:24:05 ERROR: Authentication configuration error.
heartbeat[3707]: 2016/12/29_04:24:05 ERROR: Configuration error, heartbeat not started.
[root@slave ha.d]# /etc/init.d/heartbeat start
Starting High-Availability services: INFO: Resource is stopped
Heartbeat failure [rc=6]. Failed.
heartbeat: udpport setting must precede media statementsheartbeat[3847]: 2016/12/29_18:35:53 ERROR: Client child command [/usr/lib/heartbeat/ipfail] is not executable
heartbeat[3847]: 2016/12/29_18:35:53 ERROR: Heartbeat not started: configuration error.
heartbeat[3847]: 2016/12/29_18:35:53 ERROR: Configuration error, heartbeat not started.
编辑回复