一,前期准备
1、Heartbeat集群必须的硬件
构建一个Heartbeat集群系统必须的硬件设备有:
节点服务器、网络和网卡、共享磁盘
2、操作系统规划
每个节点服务器都有两块网卡,一块用作连接公用网络,另一块通过以太网交叉线连接两个节点,作为心跳监控
3,ip规划
节点类型 |
ip地址 |
主机名 |
类型 |
主节点(rhel 5.5) |
eth0:18.1.30.60 | priv3.wolf.org |
private |
eth1:192.168.87.130 | test3.wolf.org |
public |
|
eth1:0 192.168.87.100 |
virtual |
||
备用节点(rhel 6.0) |
eth0:18.1.30.61 | priv4.wolf.org | private |
eth1:192.168.87.144 | test4.wolf.org | public |
4,域名解析
[root@test3 ~]# vim /etc/hosts
127.0.0.1 localhost.localdomain localhost
18.1.30.60 priv3.wolf.org priv3
18.1.30.61 priv4.wolf.org priv4
192.168.87.130 test3.wolf.org test3
192.168.87.144 test4.wolf.org test4
5,所必须的软件包
yum install -y libxml2 libxml2-devel bzip2-devel glib2-devel gettext intltool autoconf automake libtool-ltdl-devel libuuid-devel pkgconfig libxslt-devel libtool
二、安装heartbeat
这里的安装以heartbeat3.x为讲解对象,以下操作需要在两个节点都进行安装,基本安装过程为:
首先建立相关用户hacluster和组haclient,然后设定环境变量,最后就是安装heartbeat,过程如下:
1、添加用户和组
groupadd haclient
useradd -g haclient hacluster
2、设置环境变量
vi /root/.bash_profile,添加如下内容:
export PREFIX=/usr/local/ha
export LCRSODIR=$PREFIX/libexec/lcrso
export CLUSTER_USER=hacluster
export CLUSTER_GROUP=haclient
export CFLAGS="$CFLAGS -I$PREFIX/include -L$PREFIX/lib"
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}
heartbeat3.x版本把安装包分成了4个部分,分别是:Cluster Glue、Resource Agents、heartbeat和pacemaker,所以要分别安装,可以从http://hg.linux-ha.org、http://hg.clusterlabs.org下载对应的软件包,这里使用的软件版本分别为:
glue-1.0.9、ClusterLabs-resource-agents-v3.9.2-0-ge261943.tar、heartbeat-STABLE-3.0.4、Pacemaker-1.0.10
1)安装Cluster Glue
tar jxvf Reusable-Cluster-Components-glue--glue-1.0.9.tar.bz2
cd Reusable-Cluster-Components-glue--glue-1.0.9.tar.bz2
./autogen.sh
./configure --prefix=$PREFIX --with-daemon-user=${CLUSTER_USER} --with-daemon-group=${CLUSTER_GROUP} --enable-fatal-warnings=no
make
make install
注意:
(1)报错出现configure: WARNING: no configuration information is in libltdl 说明有软件包没有装 这个软件包就是 libtool-ltdl-devel
2)安装Resource Agents
tar jxvf Cluster-Resource-Agents-5ae70412eec8.tar.bz2
cd Cluster-Resource-Agents-5ae70412eec8
./autogen.sh
./configure --prefix=$PREFIX --enable-fatal-warnings=no
make
make install
3)安装heartbeat
tar jxvf Heartbeat-3-0-fcd56a9dd18c.tar.bz2
cd Heartbeat-3-0-fcd56a9dd18c
./bootstrap
./configure --prefix=$PREFIX --enable-fatal-warnings=no
make
make install
4)安装pacemaker
tar jxvfPacemaker-1-0-c3869c00c759.tar.bz2
cd Pacemaker-1-0-c3869c00c759
./autogen.sh
./configure --prefix=$PREFIX --with-lcrso-dir=$LCRSODIR --enable-fatal-warnings=no
make
make install
5)安装图像管理工具Pacemaker-Python-GUI
tar jxvf Pacemaker-Python-GUI-18332eae086e.tar.bz2
cd Pacemaker-Python-GUI-18332eae086e
./bootstrap --prefix=$PREFIX CFLAGS="$CFLAGS -I$PREFIX/include -L$PREFIX/lib64"
make
make install
可能出现如下报错:aclocal:configure.in:57: warning: macro `AM_PO_SUBDIRS' not found in library ./configure: line 2064: syntax error near unexpected token `0.35.2' ./configure: line 2064: `AC_PROG_INTLTOOL(0.35.2)‘只需安装gettext和intltool软件包即可
三,安装排错
1、libtoolize: `COPYING.LIB' not found in `/usr/share/libtool/libltdl'
解决办法:
yum -y install libtool-ltdl-devel
2、checking for special libxml2 includes... configure: error: libxml2 config not found
解决办法:
yum -y install libxml2
3、configure: error: BZ2 libraries not found
解决办法:
yum -y install bzip2-devel glib2-devel
前三种感觉是常识性问题,各位如果经常安装源码包的话这种错误解决起来应该很easy的。
4、安装Reusable-Cluster-Components-glue--glue-1.0.9
./.libs/libplumb.so: undefined reference to `uuid_parse’
./.libs/libplumb.so: undefined reference to `uuid_generate’
./.libs/libplumb.so: undefined reference to `uuid_copy’
./.libs/libplumb.so: undefined reference to `uuid_is_null’
./.libs/libplumb.so: undefined reference to `uuid_unparse’
./.libs/libplumb.so: undefined reference to `uuid_clear’
./.libs/libplumb.so: undefined reference to `uuid_compare’
collect2: ld returned 1 exit status
gmake[2]: *** [ipctest] Error 1
gmake[2]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6/lib/clplumbing’
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6/lib’
make: *** [all-recursive] Error 1
解决办法:
./configure --prefix=$PREFIX --with-daemon-user=${CLUSTER_USER} --with-daemon-group=${CLUSTER_GROUP} --enable-fatal-warnings=no LIBS='/lib64/libuuid.so.1'
各位在./configure的时候指定一下LIBS,如果是32位系统的话改成LIBS='/lib/libuuid.so.1'。下面ClusterLabs-resource Heartbeat在./configure的时候都指定一下,要不然继续报错。
5、
uuid_parse.c:250: error: expected ‘;’, ‘,’ or ‘)’ before ‘uu’
uuid_parse.c:469: error: expected ‘)’ before ‘out’
uuid_parse.c:484: error: expected ‘)’ before ‘out’
uuid_parse.c:512: error: expected ‘)’ before ‘out’
gmake[1]: *** [uuid_parse.lo] Error 1
gmake[1]: Leaving directory `/usr/src/Heartbeat-3-0-7e3a82377fa8/replace'
make: *** [all-recursive] Error 1
解决办法:
# ./configure --prefix=$PREFIX --enable-fatal-warnings=no LIBS='/lib64/libuuid.so.1'
6,
gmake[1]: --xinclude: Command not found
gmake[1]: *** [heartbeat.8] Error 127
gmake[1]: Leaving directory `/usr/src/Heartbeat-3-0-7e3a82377fa8/doc'
make: *** [all-recursive] Error 1
解决办法:
# yum -y install libxslt-devel
7,
error : Operation in progress
warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/html/formal.xsl"
compilation error: file http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl line 46 element include
xsl:include : unable to load http://docbook.sourceforge.net/release/xsl/current/html/formal.xsl
http://docbook.sourceforge.net/release/xsl/current/html/table.xsl:1: parser error : Document is empty
http://docbook.sourceforge.net/release/xsl/current/html/table.xsl:1: parser error : Start tag expected, '<' not found
compilation error: file http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl line 47 element include
xsl:include : unable to load http://docbook.sourceforge.net/release/xsl/current/html/table.xsl
解决办法:一些文档需要到互联网上去下,目前为止make过程中除了doc没有安装外,其他的都已经成功安装了,所以该问题可以忽略。
8,
checking for openais/saAis.h... no
checking corosync/coroipcc.h usability... no
checking corosync/coroipcc.h presence... no
checking for corosync/coroipcc.h... no
configure: WARNING: Unable to support OpenAIS: Whitetank headers not found
checking for supported stacks... configure: error: in `/root/Pacemaker-1-0-c3869c00c759':
configure: error: You must choose at least one cluster stack to support
See `config.log' for more details.
解决方法:编译时加入LDFLAGS=-L$PREFIX/lib64
[root@test4 Pacemaker-1-0-c3869c00c759]# ./configure --prefix=$PREFIX --with-lcrso-dir=$LCRSODIR LDFLAGS=-L$PREFIX/lib64 --enable-fatal-warnings=no
9,
cc1: warnings being treated as errors
mgmt_lib.c: In function 'init_mgmt_lib':
mgmt_lib.c:97: warning: implicit declaration of function 'is_heartbeat_cluster'
gmake[2]: *** [libhbmgmt_la-mgmt_lib.lo] Error 1
gmake[2]: Leaving directory `/data0/Pacemaker-Python-GUI-c08b84a8203f/mgmt/daemon'
gmake[1]: *** [all-recursive] Error 1
解决办法:在mgmt/daemon/mgmt_lib.c 文件中加入 #include <crm/common/cluster.h>继续执行make指令
10,
mgmtd.c: 在函数‘register_pid’中:
mgmtd.c:299: 错误:隐式声明函数‘umask’
gmake[2]: *** [mgmtd.o] 错误 1
gmake[2]: Leaving directory `/root/install/Pacemaker-Python-GUI-c08b84a8203f/mgmt/daemon'
gmake[1]: *** [all-recursive] 错误 1
gmake[1]: Leaving directory `/root/install/Pacemaker-Python-GUI-c08b84a8203f/mgmt'
make: *** [all-recursive] 错误 1
解决办法:在mgmt/daemon/mgmtd.c 文件中加入 #include<sys/stat.h> 继续执行make指令
11,
wrap.Tpo -c ./pymgmt_wrap.c -fPIC -DPIC -o .libs/_pymgmt_la-pymgmt_wrap.o
gcc: ./pymgmt_wrap.c: No such file or directory
gcc: no input files
gmake[2]: *** [_pymgmt_la-pymgmt_wrap.lo] Error 1
gmake[2]: Leaving directory `/root/Pacemaker-Python-GUI-18332eae086e/lib/mgmt'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/root/Pacemaker-Python-GUI-18332eae086e/lib'
make: *** [all-recursive] Error 1
这个问题尚待解决,希望好心网友能给我指明方向,感激不尽~~~~!!!!!
12
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
13
解决 configure.ac:17: error: possibly undefined macro: AC_PROG_LIBTOOL
原来缺少一个工具:yum -y install libtool
安装之后惊喜
之后为了保证不出错 ,还需要安装一个工具:yum -y install libsysfs-devel
本文出自 “好好活着” 博客,请务必保留此出处http://wolfword.blog.51cto.com/4892126/1210647