CentOS6.2编译安装Heartbeat

 

1、安装cluster glue

安装heartbeat之前需要安装glue。

  1. yum install autoconf automake libtool glib2-devel libxml2-devel bzip2-devel e2fsprogs-devel libxslt-devel libtool-ltdl-devel make wget(红色标记处也需要安装)
  2. groupadd haclient
  3. useradd -g haclient hacluster
  4. cd /tmp
  5. wget http://hg.linux-ha.org/glue/archive/glue-1.0.9.tar.bz2
  6. tar xjf glue-1.0.9.tar.bz2
  7. cd Reusable-Cluster-Components-glue--glue-1.0.9
  8. ./autogen.sh
  9. ./configure --prefix=/usr/local/heartbeat LIBS=’/lib/libuuid.so.1‘(64位系统上是LIBS=’/lib64/libuuid.so.1‘)
  10. make && make install

安装过程中会在INTERNET中校验一些xml文件,会耗费大量时间,要耐心等待。如果报错可能是网络引起,多试几次就行(yum install docbook-dtds docbook-style-xsl安装这两个包之后解决 )。

安装Resource Agents

  1. cd /tmp
  2. wget --no-check-certificate https://github.com/ClusterLabs/resource-agents/tarball/v3.9.2
  3. tar xzf v3.9.2
  4. cd ClusterLabs-resource-agents-b735277/
  5. ./autogen.sh
  6. ./configure --prefix=/usr/local/heartbeat CFLAGS=-I/usr/local/heartbeat/include LDFLAGS=-L/usr/local/heartbeat/lib LIBS=’/lib/libuuid.so.1‘(64位系统上是LIBS=’/lib64/libuuid.so.1‘)
  7. ln -s /usr/local/heartbeat/lib/* /lib/ (64位系统是ln -s /usr/local/heartbeat/lib/* /lib64/ 解决libplumb.so.2等包找不到的问题,./configure的时候会产生一些需要的包)
  8. make && make install

安装Heartbeat

  1. cd /tmp
  2. wget http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/7e3a82377fa8.tar.bz2
  3. tar xjf 7e3a82377fa8.tar.bz2
  4. cd Heartbeat-3-0-7e3a82377fa8/
  5. ./bootstrap
  6. ./configure --prefix=/usr/local/heartbeat CFLAGS=-I/usr/local/heartbeat/include LDFLAGS=-L/usr/local/heartbeat/lib LIBS='/lib64/libuuid.so.1'
  7. vim /usr/local/heartbeat/include/heartbeat/glue_config.h
  8. 删除最后一行:#define HA_HBCONF_DIR “/usr/local/heartbeat/etc/ha.d/”(解决glue_config.h:99:1: error: "HA_HBCONF_DIR" redefined错误)
  9. make && make install
  10. cp doc/ha.cf /usr/local/heartbeat/etc/ha.d/
  11. cp doc/haresources /usr/local/heartbeat/etc/ha.d/
  12. cp doc/authkeys /usr/local/heartbeat/etc/ha.d/
  13. cp heartbeat/init.d/heartbeat /etc/rc.d/init.d/
  14. chkconfig --add heartbeat
  15. chkconfig heartbeat on
  16. chmod 600 /usr/local/heartbeat/etc/ha.d/authkeys
  17. sed -i 's#/usr/lib/ocf#/usr/local/heartbeat/usr/lib/ocf#g' /usr/local/heartbeat/etc/ha.d/shellfuncs
  18. sed -i 's#/usr/lib/ocf#/usr/local/heartbeat/usr/lib/ocf#g' /usr/local/heartbeat/usr/lib/ocf/lib//heartbeat/ocf-shellfuncs
  19. sed -i 's#/usr/lib/ocf#/usr/local/heartbeat/usr/lib/ocf#g' /usr/local/heartbeat/etc/ha.d/resource.d//hto-mapfuncs

(上面17、18、19三条是用新的路径替换默认路径,将/usr/lib/ocf替换为/usr/local/heartbeat/usr/lib/ocf)

你可能感兴趣的:(heartbeat)