本想依照南非蚂蚁的博客安装配置一下heartbeat3,但是发现安装的过程很曲折,特在此记录一下安装过程中的问题及解决办法,希望别人能少走弯路。

安装可参考该英文网站:http://clusterlabs.org/wiki/Install#From_Source

http://ixdba.blog.51cto.com/2895551/746271

首先:

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

 

 

1、添加用户和组

 

   
   
   
   
  1. # groupadd haclient 
  2. # useradd -g haclient hacluster 

 

2、设置变量

 

   
   
   
   
  1. vim /root/.bash_profile 
  2. 添加: 
  3. export PREFIX=/usr/local/ha 
  4. export LCRSODIR=/usr/libexec/lcrso 
  5. export CLUSTER_USER=hacluster 
  6. export CLUSTER_GROUP=haclient 
  7. export CFLAGS="$CFLAGS -I$PREFIX/include -L$PREFIX/lib" 
  8. getent group ${CLUSTER_GROUP} >/dev/null || groupadd -r ${CLUSTER_GROUP} 
  9. 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} 
  10.   
  11. source /root/.bash_profile 

 

3、安装各个模块软件包

1)安装Cluster Glue

 

   
   
   
   
  1. tar jxvf Reusable-Cluster-Components-glue--glue-1.0.9.tar.bz2 
  2. cd Reusable-Cluster-Components-glue--glue-1.0.9 
  3. ./autogen.sh 
  4. ./configure --prefix=$PREFIX  --with-daemon-user=${CLUSTER_USER} --with-daemon-group=${CLUSTER_GROUP} --enable-fatal-warnings=no 
  5. make 

 

错误:

/usr/bin/xsltproc \

--xinclude \

http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl hb_report.xml

error : Operation in progress

warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"

cannot parse http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl

gmake[2]: *** [hb_report.8] 错误 4

gmake[2]: Leaving directory `/usr/local/src/heartbeat/Reusable-Cluster-Components-glue--glue-1.0.9/doc'

gmake[1]: *** [all-recursive] 错误 1

gmake[1]: Leaving directory `/usr/local/src/heartbeat/Reusable-Cluster-Components-glue--glue-1.0.9/doc'

make: *** [all-recursive] 错误 1

解决:

yum -y install docbook*

 

 

   
   
   
   
  1. make install 

 

2)安装Resource Agents

 

   
   
   
   
  1. tar zxvf ClusterLabs-resource-agents-v3.9.2-0-ge261943.tar.gz 
  2. cd ClusterLabs-resource-agents-b735277/ 
  3. ./autogen.sh 

 

出现错误:

configure.ac:9: error: Autoconf version 2.63 or higher is required

解决:

下载并安装autoconf-2.68.tar.gz

./configure

make;make install

 

出现错误:

configure.ac:63: require Automake 1.10.1, but have 1.9.6

解决:

下载并安装automake-1.11.2.tar.gz

 

 

   
   
   
   
  1. ./configure --prefix=$PREFIX CFLAGES=-I/usr/local/ha/include  LDFLAGS=-L/usr/local/ha/lib 
  2. make 

 

错误:

../heartbeat/IPv6addr: error while loading shared libraries: libplumb.so.2: cannot open shared object file: No such file or directory

解决:

vim /etc/ld.so.conf.d/heartbeat.conf(没有heartbeat.conf,自己创建)

ldconfig

然后进行make,注意如果前面make错误,使用make clean ,然后重新编译再make

 

 

   
   
   
   
  1. make install 

 

3)安装heartbeat

 

   
   
   
   
  1. tar jxvf Heartbeat-3-0-7e3a82377fa8.tar.bz2 
  2. cd Heartbeat-3-0-7e3a82377fa8 
  3. ./bootstrap 
  4. ./configure --prefix=$PREFIX --enable-fatal-warnings=no 
  5. make 
  6. make install 

 

4)安装pacemaker(使用1.0.12,使用1.1.2编译不过去,有问题)

 

   
   
   
   
  1. tar zxvf pacemaker-1.0.12.tar.gz 
  2. cd ClusterLabs-pacemaker-1.0-066152e/ 
  3.  ./autogen.sh 

 

错误:

configure.ac:81: error: possibly undefined macro: AC_LIBTOOL_DLOPEN

      If this token and others are legitimate, please use m4_pattern_allow.

      See the Autoconf documentation.

configure.ac:82: error: possibly undefined macro: AC_LIBLTDL_CONVENIENCE

configure.ac:83: error: possibly undefined macro: AC_PROG_LIBTOOL

解决:

yum -y install libtool libtool-libs

 

   
   
   
   
  1. ./configure --prefix=/usr/local/ha --with-heartbeat CFLAGES=-I/usr/local/ha/include  LDFLAGS=-L/usr/local/ha/lib64 

 

编译的时候报错:

checking location of OpenAIS libraries... ls: /usr/local/ha/*/libcpg.so: No such file or directory

解决:

修改configure,找到alib=`ls ${AISPREFIX}/*/libcpg.so | head -n 1`修改为:

alib=`ls ${AISPREFIX}/libcpg.so | head -n 1`,重新编译

 

 

   
   
   
   
  1. make 
  2. make install 
  3. ldconfig -v 

 

5)安装图像管理工具Pacemaker-Python-GUI(因为使用的Pacemaker1.0的版本,所以这个使用2.0,不要使用官方推荐的,官方推荐的是针对Pacemaker1.2的)

 

   
   
   
   
  1. tar jxvf Pacemaker-Python-GUI-18332eae086e.tar.bz2 
  2. cd Pacemaker-Python-GUI-18332eae086e 
  3. ./bootstrap --prefix=/usr/local/ha CFLAGES=-I/usr/local/ha/include  LDFLAGS=-L/usr/local/ha/lib64 
  4.   

如果出现错误:

报错如下:aclocal:configure.in:57: warning: macro `AM_PO_SUBDIRS‘ not found in library

> autoheader

> libtoolize –ltdl –force –copy

> aclocal-1.9

> aclocal:configure.in:57: warning: macro `AM_PO_SUBDIRS‘ not found in library

> automake-1.9 –add-missing –include-deps –copy

> configure.in: installing `./install-sh’

> configure.in: installing `./missing’

> cim/Makefile.am: installing `./depcomp’

> lib/mgmt/Makefile.am: installing `./compile’

> autoconf

> configure.in:56: error: possibly undefined macro: AC_PROG_INTLTOOL

> If this token and others are legitimate, please use m4_pattern_allow.

> See the Autoconf documentation.

> configure.in:57: error: possibly undefined macroAM_PO_SUBDIRS

 

解决:

安装gettextintltool

yum -y install gettext*  intltool

 

 

   
   
   
   
  1. make 

 

如果出现错误:

mgmt_tls_lib.c:31:27: error: gnutls/gnutls.h: No such file or directory

解决办法:

yum -y install gnutls*

ldconfig

make clean

重新./configure

然后再make

 

 

   
   
   
   
  1. make install