我相信很多没有经验的人对于如何编写在Linux中安装心跳3.0的集群源代码是很无奈的。因此,本文总结了出现问题的原因和解决方法,希望大家可以通过这篇文章来解决这个问题。
一,前期准备
1.心跳集群的必要硬件。
构建心跳集群系统所需的硬件设备有:
服务器、网络和网卡以及共享磁盘。
2.操作系统规划。
每个节点服务器有两个网卡,一个用于连接公网,另一个通过以太网跨线连接两个节点作为心跳监控。
3.知识产权规划。
节点类型
ip地址
主机名
类型
主节点(rhel 5.5)
eth0:18.1.30.60
priv3.wolf.org
私人的
eth2:192.168.87.130
test3.wolf.org
公众的
eth2:0 192.168.87.100
虚拟的
备用节点(rhel 6.0)
eth0:18.1.30.61
priv4.wolf.org
私人的
eth2:192.168.87.144
test4.wolf.org
公众的
4.域名解析。
[root@test3 ~]# vim /etc/hosts
127 . 0 . 0 . 1 localhost . local domain localhost
18.1.30.60priv3.wolf.org普里3
18.1.30.61priv4.wolf.org普里4
192 . 168 . 87 . 130 test3.wolf.org测试3
test4.wolf.org测试4
5、必要的软件包。
yum install-y libxml2libxml 2-dev bzip 2-dev gli B2-dev gettext intl tool auto info automake lib
tool-ltdl-devel libuuid-devel pkgconfig libxslt-devellibtool
二、安装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 "clusteruser" ${CLUSTER_USER}
heartbeat3.x版本把安装包分成了4个部分,分别是:ClusterGlue、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 jxvfReusable-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 jxvfCluster-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 jxvfPacemaker-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 inlibrary ./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 forspecial 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-resourceHeartbeat在./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: filehttp://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl line 46element 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: filehttp://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl line 47element include
xsl:include : unable to loadhttp://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 supportOpenAIS: Whitetank headers not found
checking for supported stacks... configure:error: in `/root/Pacemaker-1-0-c3869c00c759':
configure: error: You must choose at leastone 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=$LCRSODIRLDFLAGS=-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: implicitdeclaration 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 ordirectory
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 Automake1.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
看完上述内容,你们掌握Linux安装heartbeat 3.0集群源码怎么写的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/41721.html