[root@www yum.repos.d]# rpm -qi heartbeat //查询heartbeat包的说明信息。包括版本号,来源,描 // 述等
Name : heartbeat Relocations: (not relocatable)
Version : 3.0.4 Vendor: Fedora Project
Release : 2.el6 Build Date: Tue 03 Dec 2013 12:37:21 AM CST
Install Date: Wed 02 Nov 2016 11:48:07 PM CST Build Host: buildvm-14.phx2.fedoraproject.org
Group : System Environment/Daemons Source RPM: heartbeat-3.0.4-2.el6.src.rpm
Size : 269152 License: GPLv2 and LGPLv2+
Signature : RSA/8, Tue 03 Dec 2013 06:59:13 AM CST, Key ID 3b49df2a0608b895
Packager : Fedora Project
URL : http://linux-ha.org/
Summary : Messaging and membership subsystem for High-Availability Linux
Description :
heartbeat is a basic high-availability subsystem for Linux-HA.
It will run scripts at initialization, and when machines go up or down.
This version will also perform IP address takeover using gratuitous ARPs.
Heartbeat contains a cluster membership layer, fencing, and local and
clusterwide resource management functionality.
When used with Pacemaker, it supports "n-node" clusters with significant
capabilities for managing resources and dependencies.
In addition it continues to support the older release 1 style of
2-node clustering.
It implements the following kinds of heartbeats:
- Serial ports
- UDP/IP multicast (ethernet, etc)
- UDP/IP broadcast (ethernet, etc)
- UDP/IP heartbeats
- "ping" heartbeats (for routers, switches, etc.)
(to be used for breaking ties in 2-node systems)
[root@www yum.repos.d]# rpm -ql heartbeat //heartbeat安装完后生成的文件
/etc/ha.d
/etc/ha.d/README.config
/etc/ha.d/harc
/etc/ha.d/rc.d
/etc/ha.d/rc.d/ask_resources
/etc/ha.d/rc.d/hb_takeover
/etc/ha.d/rc.d/ip-request
/etc/ha.d/rc.d/ip-request-resp
/etc/ha.d/rc.d/status
/etc/ha.d/resource.d
/etc/ha.d/resource.d/AudibleAlarm
/etc/ha.d/resource.d/Delay
/etc/ha.d/resource.d/Filesystem
[root@www etc]# cp /usr/share/doc/heartbeat-3.0.4/{authkeys,haresources,ha.cf} /etc/ha.d/ -p
[root@www etc]# dd if=/dev/random bs=512 count=1 |md5sum //产生512长的随机数在用MD5加密
0+1 records in
0+1 records out
53 bytes (53 B) copied, 0.000186312 s, 284 kB/s
e4b8f2837725f10ed16bfd1738b89541 -
[root@www etc]# vim /etc/ha/authkeys
auth 1
1 md5 e4b8f2837725f10ed16bfd1738b89541 //采用MD5加密通信
[root@www etc]# vim /etc/ha/ha.cf
#
# File to write debug messages to
#debugfile /var/log/ha-debug //debug的调试日志
#
#
# File to write other messages to
#
logfile /var/log/ha-log //ha的日志
#
#
# Facility to use for syslog()/logger
#
#logfacility local0 //local0表示一个日志设施,表示用syslog来记录日志,不能与logfile同 //时启用
#
#
# A note on specifying "how long" times below...
#
# The default time unit is seconds
# 10 means ten seconds
#
# You can also specify them in milliseconds
# 1500ms means 1.5 seconds
#
#
# keepalive: how long between heartbeats?
#
keepalive 2 //每两秒发一次心跳信息
deadtime 30 //30秒未收到对方心跳信息就认为对方挂掉了
#udpport 694 //以UDP/694传输心跳信息
#bcast eth0 # Linux //以广播形式传递心跳信息,且从eth0网卡传输
#bcast eth1 eth2 # Linux
#mcast eth0 225.0.0.1 694 1 0 //以组播255.0.0.1从eth0传输,TTL值,循环值
#ucast eth0 192.168.1.2 //以单播192.1681.2传输
#auto_failback on //节点恢复正常后是否再将资源转移回来
#node ken3
#node kathy //在此处下方要加入你的集群节点,要与uname -n命令显示一致
node www.rs1.com
node www.rs2.com
#
ping 10.10.10.254 //可以ping网关192.168.139.1来判断自己是否挂掉了
#ping_group group1 10.10.10.254 10.10.10.253//还可以通过Ping这个组中任意一个来判断自己是否 //挂掉
#respawn hacluster /usr/lib/heartbeat/ipfail //定义节点挂掉后是否进行重启
[root@www etc]# vim /etc/ha/haresources
#
# An example where a shared filesystem is to be used.
# Note that multiple aguments are passed to this script using
# the delimiter '::' to separate each argument.
#
#node1 10.0.0.170 Filesystem::/dev/sda1::/data1::ext2