1、涉及机器

192.168.130.61 node1.ha.com http

192.168.130.62 node2.ha.com http

192.168.130.63 node3.ha.com nfs


2、安装heartbeat V2

rpm -ivh https://mirrors.aliyun.com/epel/6Server/x86_64/Packages/e/epel-release-6-8.noarch.rpm

yum -y install net-snmp-libs libnet PyXML libtool-ltdl

rpm -ivh heartbeat-2.1.4-12.el6.x86_64.rpm heartbeat-pils-2.1.4-12.el6.x86_64.rpm heartbeat-stonith-2.1.4-12.el6.x86_64.rpm


3、配置hearbeat V2

openssl rand -hex 16

c20954be14c956fc9dec4f8b6565da34


cp /usr/share/doc/heartbeat-2.1.4/{authkeys,ha.cf} /etc/ha.d/


cd /etc/ha.d

echo -e "auth 2\n2 sha1 c20954be14c956fc9dec4f8b6565da34" >> authkeys

chmod 600 authkeys 


grep -v ^# ha.cf | grep -v ^$

logfile /var/log/ha-log

keepalive 1

deadtime 10

warntime 5

initdead 120

udpport 694

mcast eth0 225.0.0.1 694 1 0

auto_failback on

node node1.ha.com node2.ha.com

ping 192.168.130.2

compression     bz2

compression_threshold 2

crm on


scp -p authkeys ha.cf node2.ha.com:/etc/ha.d/

service iptables stop

chkconfig iptables off

sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

setenforce 0


4、安装httpd

yum -y install httpd


5、安装NFS共享存储

yum -y install nfs-utils rpcbind

mkdir /www

echo "/www 192.168.130.0/24(rw,sync,no_root_squash)" >> /etc/exports

service rpcbind start           

service nfs start

chkconfig rpcbind on

chkconfig nfs on


echo "

NFS

" > /www/index.html


6、基于heartbeat-gui配置heartbeat V2


需要安装xmanager和xsell


yum -y install pygtk2-libglade

rpm -ivh heartbeat-gui-2.1.4-12.el6.x86_64.rpm 


启用heartbeat-gui的机器需要设置hacluster的密码

passwd hacluster


service heartbeat start


yum -y install xorg-x11-xauth dejavu-lgc-sans-fonts

hb_gui &

62、Heartbeat V2基于NFS共享存储的WEB高可用实战(基于heartbeat-gui)_第1张图片62、Heartbeat V2基于NFS共享存储的WEB高可用实战(基于heartbeat-gui)_第2张图片62、Heartbeat V2基于NFS共享存储的WEB高可用实战(基于heartbeat-gui)_第3张图片62、Heartbeat V2基于NFS共享存储的WEB高可用实战(基于heartbeat-gui)_第4张图片62、Heartbeat V2基于NFS共享存储的WEB高可用实战(基于heartbeat-gui)_第5张图片62、Heartbeat V2基于NFS共享存储的WEB高可用实战(基于heartbeat-gui)_第6张图片62、Heartbeat V2基于NFS共享存储的WEB高可用实战(基于heartbeat-gui)_第7张图片



7、测试

[root@node3 ~]# curl http://192.168.130.15

NFS

[root@node3 ~]#