1. 首先建立相关用户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,所以要分别安装
glue下载地址:
2. 编译安装glue
tar –xjvf Reusable-Cluster-Components-glue--5e06b2ddd24b.tar.bz2
cd Reusable-Cluster-Components-glue--5e06b2ddd24b
./autogen.sh
./configure --prefix=$PREFIX --with-daemon-user=${CLUSTER_USER} --with-daemon-group=${CLUSTER_GROUP} --enable-fatal-warnings=no
make
make install
3. 编译安装Agent
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
4. 编译安装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
5.编译安装Pacemaker
没有成功,最后一个错误没有能够解决,求指导!
过程中出现错误汇总:
checking for special libxml2 includes... configure: error: libxml2 config not found
解决方法:
sudo apt-get install libxml2-dev
configure: error: BZ2 Development headers not found
解决方法:
sudo apt-get install libbz2-dev
./.libs/libplumb.so: undefined reference to `uuid_clear'
./.libs/libplumb.so: undefined reference to `uuid_unparse'
./.libs/libplumb.so: undefined reference to `uuid_copy'
./.libs/libplumb.so: undefined reference to `uuid_compare'
./.libs/libplumb.so: undefined reference to `uuid_is_null'
./.libs/libplumb.so: undefined reference to `uuid_generate'
./.libs/libplumb.so: undefined reference to `uuid_parse'
解决方法:
sudo apt-get install uuid-dev
./configure --prefix=$PREFIX --with-daemon-user=${CLUSTER_USER} --with-daemon-group=${CLUSTER_GROUP} --enable-fatal-warnings=no LIBS='/lib/x86_64-linux-gnu/libuuid.so.1'
a2x -f manpage hb_report.8.txt
make[2]: a2x: Command not found
解决方法:
sudo apt-get install asciidoc
configure: error: The libxslt developement headers were not found
解决方法:
sudo apt-get install libxslt1-dev
checking main() in -lplumb...no
解决方法:
sudo apt-get install libplumb2-dev
../lib/pengine/.libs/libpe_status.so: undefined reference to `stdscr'
../lib/pengine/.libs/libpe_status.so: undefined reference to `wmove'
../lib/pengine/.libs/libpe_status.so: undefined reference to `printw'
一直没找到答案,求大神指导!
推荐阅读:
Linux 高可用(HA)集群之heartbeat基于crm进行资源管理详解
Heartbeat+httpd+NFS 实现高可用的Web服务器
更多Ubuntu相关信息见Ubuntu 专题页面 ?tid=2