一、安裝heartbeat。
HA前提:1、時間同步; 2、SSH雙機互信; 3、主機名稱要與uname -n一致,並通過/etc/hosts解析; rpm -ivh epel-release-6-8.noarch.rpm #配置epel的源 下載地址: yum -y install heartbeat cp /usr/share/doc/heartbeat-3.0.4/{authkeys,ha.cf,haresources} /etc/ha.d/ 三個配置文件: 1、密鑰文件,600, /etc/ha.d/authkeys 2、heartbeat服務的配置配置/etc/ha.d/ha.cf 3、資源管理配置文件/etc/ha.d/haresources vim /etc/ha.d/authkeys auth 1 1 md5 0aa5b0ea86dc20192a9f25726ecd5a8a vim /etc/ha.d/ha.cf debugfile /var/log/ha-debug logfile /var/log/ha-log keepalive 5 deadtime 30 warntime 10 udpport 695 #同一Vlan如果有多個組需要改端口 bcast eth0 # 廣播 auto_failback on node node1.niiwoo.com #添加節點 node node2.niiwoo.com ping 192.168.18.1 vim /etc/ha.d/haresources #配置資源 node1 IPaddr::192.168.18.80/24/eth0 httpd #Pacemaker相關 [root@node1 ~]# vim /etc/ha.d/ha.cf pacemaker respawn ln -s /usr/libexec/pacemaker/cib /usr/lib64/heartbeat/cib ln -s /usr/libexec/pacemaker/stonithd /usr/lib64/heartbeat/stonithd ln -s /usr/libexec/pacemaker/attrd /usr/lib64/heartbeat/attrd ln -s /usr/libexec/pacemaker/crmd /usr/lib64/heartbeat/crmd