软件包:

  ClusterLabs-resource-agents-v3.9.2-0-ge261943.tar.gz
  Reusable-Cluster-Components-glue--glue-1.0.9.tar.bz2
  Heartbeat-3-0-7e3a82377fa8.tar.bz2

下载地址:http://linux-ha.org/wiki/Downloads

说明:安装时需要能连接到公网

OS:Red Hat Enterprise Linux Server release 5.8 x64,  5.5 x64

kernel: 2.6.18-308.el5 x86_64

      2.6.18-194.el5  x86_64


软件安装:

1、安装 gcc 和 必要的组件

yum install autoconf automake libtool glib2-devel libxml2-devel bzip2-devel e2fsprogs-devel libxslt-devel libtool-ltdl-devel intltool gettext-devel

2、添加 haclient 组  hacluster 账户

groupadd haclient
useradd -g haclient hacluster -M -s /sbin/nologin

3、安装 Cluster-Glue  

在安装之前不能先安装 autoconf-2.68.tar.gz  automake-1.11.2.tar.gz,否则会报错。

tar  -xjvf  Reusable-Cluster-Components-glue--glue-1.0.9.tar.bz2
 cd Reusable-Cluster-Components-glue--glue-1.0.9
                                                                                                                                                                                                                                           
./autogen.sh
#    You should add the contents of `/usr/share/aclocal/libtool.m4' to `aclocal.m4.   ?未解决,暂未影响编译
 ./configure  --prefix=/usr/local/heartbeat
 make
 make install


4、安装Resource Agents  需要先安装 autoconf-2.68.tar.gz  automake-1.11.2.tar.gz

tar -xzvf ClusterLabs-resource-agents-v3.9.2-0-ge261943.tar.gz
 cd ClusterLabs-resource-agents-b735277/
  ./autogen.sh
  export CFLAGS="$CFLAGS -I/usr/local/heartbeat/include -L/usr/local/heartbeat/lib"
  ./configure --prefix=/usr/local/heartbeat
  ln -s  /usr/local/heartbeat/lib/* /lib64/
  ln -s  /usr/local/heartbeat/lib/* /lib/
  make && make install


5、安装 heartbeat

tar -xjvf Heartbeat-3-0-7e3a82377fa8.tar.bz2
 cd Heartbeat-3-0-7e3a82377fa8
    ./bootstrap
    export CFLAGS="$CFLAGS -I/usr/local/heartbeat/include -L/usr/local/heartbeat/lib"
    ./configure --prefix=/usr/local/heartbeat
    make && make install
                                                                                                              
    cp doc/ha.cf /usr/local/heartbeat/etc/ha.d/
    cp doc/haresources /usr/local/heartbeat/etc/ha.d/
    cp doc/authkeys /usr/local/heartbeat/etc/ha.d/
    #cp heartbeat/init.d/heartbeat /etc/rc.d/init.d/
    chkconfig --add heartbeat
    chkconfig heartbeat on
    chmod 600 /usr/local/heartbeat/etc/ha.d/authkeys
   sed -i 's#/usr/lib/ocf#/usr/local/heartbeat/usr/lib/ocf#g' /usr/local/heartbeat/etc/ha.d/shellfuncs
   sed -i 's#/usr/lib/ocf#/usr/local/heartbeat/usr/lib/ocf#g' /usr/local/heartbeat/usr/lib/ocf/lib/heartbeat/ocf-shellfuncs
   sed -i 's#/usr/lib/ocf#/usr/local/heartbeat/usr/lib/ocf#g' /usr/local/heartbeat/etc/ha.d/resource.d/hto-mapfuncs

错误处理:

1、安装Resource Agents出错:./autogen.sh

出现错误:configure.ac:9: error: Autoconf version 2.63 or higher is required。

指的是autoconf版本低,需要安装高版本的。

参考 http://wolfword.blog.51cto.com/4892126/1211459

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz
tar xzf autoconf-2.68.tar.gz
cd autoconf-2.68
./configure
make && make install

2、安装Resource Agents 运行  ./autogen.sh

错误代码:configure.ac:63: require Automake 1.10.1, but have 1.9.6

解决方法:

wget http://ftp.gnu.org/gnu/automake/automake-1.11.2.tar.gz
 tar xzf automake-1.11.2.tar.gz
 cd automake-1.11.2
 ./configure
 make && make install

3、安装Resource Agents 运行 make

错误代码:

OCF_ROOT=. OCF_FUNCTIONS_DIR=../heartbeat ../heartbeat/VirtualDomain meta-data > metadata-VirtualDomain.xml
../heartbeat/VirtualDomain: line 21: virsh: command not found

关于虚拟机的,没用到虚拟机,忽略!

4、安装 heartbeat 运行 make

错误信息:

glue_config.h:105:1: error: “HA_HBCONF_DIR” redefined

原因: glue和heartbeat的版本不兼容的问题。

解决:删除/usr/local/heartbeat/include/heartbeat/glue_config.h的最后一行:

#define HA_HBCONF_DIR "/usr/local/heartbeat/etc/ha.d/"



至此 heartbeat  3.0.7 安装完成。其中heartbeat包在make时耗时比较久,主要是跟我环境连接公网的速度有关。