Heartbeat3.x与之前的2.x相比,确实增强了许多功能,但其安装有时候却并不容易,在目前的生产环境中其经常与Pacemaker一起使用来搭建HA环境,而Pacemaker除了支持Heartbeat外,还支持Corosync和OpenAIS实现心跳通信。
环境基本介绍:
master: 10.11.203.15
eth0: 10.11.203.15/22 eth0:0: 10.11.203.17/22(vip)
eth1: 10.13.203.15/22 eth1:0: 10.23.203.17/22(vip)
slave: 10.11.203.16
eth0: 10.11.203.16/22
eth1: 10.13.203.16/22
1. 配置编译环境,并创建运行Heartbeat的默认账户和组(其中LCRSODIR在使用Corosync才会用到)。
export PREFIX=/usr export LCRSODIR=$PREFIX/libexec/lcrso export CLUSTER_USER=hacluster export CLUSTER_GROUP=haclient getent group ${CLUSTER_GROUP} > /dev/null || groupadd -r ${CLUSTER_GROUP} getent passwd ${CLUSTER_USER} > /dev/null || useradd -r -g ${CLUSTER_GROUP} -d /var/lib/heartbeat/cores/hacluster -s /sbin/nologin -c "cluster user" ${CLUSTER_USER}2. 安装依赖软件包并升级编译工具。
yum -y install bison bison-devel docbook-style-xsl flex gettext gettext-devel gnutls gnutls-devel intltool OpenIPMI OpenIPMI-devel tar zxvf autoconf-2.68.tar.gz cd autoconf-2.68 ./configure --prefix=/usr/ make && make install cd .. tar zxvf automake-1.11.tar.gz cd automake-1.11 ./configure --prefix=/usr/ make && make install cd .. tar zxvf libtool-2.4.tar.gz cd libtool-2.4 ./configure --prefix=/usr/ make && make install cd ..3. 安装Heartbeat依赖软件包并拷贝相关配置文件。
tar jxvf Reusable-Cluster-Components-* cd Reusable-Cluster-Components-* ./autogen.sh && ./configure --prefix=$PREFIX --enable-fatal-warnings --with-daemon-user=${CLUSTER_USER} --with-daemon-group=${CLUSTER_GROUP} find . -name "Makefile" -exec sed -i 's/-Werror//' {} \; make && make install cd .. echo "/usr/lib" >> /etc/ld.so.conf.d/pacemaker.conf ldconfig -v tar zxvf ClusterLabs-resource-agents-* cd ClusterLabs-resource-agents-* ./autogen.sh && ./configure --prefix=$PREFIX --enable-fatal-warnings find . -name "Makefile" -exec sed -i 's/-Werror//' {} \; make && make install cd .. ldconfig -v tar jxvf Heartbeat-* cd Heartbeat-* ./bootstrap && ./configure --prefix=$PREFIX --enable-fatal-warnings find . -name "Makefile" -exec sed -i 's/-Werror//' {} \; make && make install cd .. cp $PREFIX/share/doc/heartbeat/ha.cf $PREFIX/etc/ha.d/ cp $PREFIX/share/doc/heartbeat/haresources $PREFIX/etc/ha.d/ cp $PREFIX/share/doc/heartbeat/authkeys $PREFIX/etc/ha.d/ chmod 600 $PREFIX/etc/ha.d/authkeys ldconfig -v