Chinaunix首页 | 论坛 | 博客
  • 博客访问: 114741
  • 博文数量: 35
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 10
  • 用 户 组: 普通用户
  • 注册时间: 2012-12-11 16:26
文章分类
文章存档

2013年(35)

我的朋友

分类: LINUX

2013-09-05 21:28:11

原文地址:Heartbeat安装过程 作者:jokzheng

一、首先安装一些库文件,避免在安装过程中出现库文件不存在的情况。

  1. yum install gcc gcc-c++ autoconf automake libtool glib2-devel libxml2-devel bzip2-devel e2fsprogs-devel libxslt-devel libtool-ltdl-devel make wget docbook-dtds docbook-style-xsl

二、添加用户和组
groupadd haclient
useradd -g haclient hacluster -M -s /sbin/nologin


三、安装Cluster-Glue
 官方下载地址






       
      






  1. tar zxf Reusable-Cluster-Components-glue--1.0.8.tar.gz
  2. cd Reusable-Cluster-Components-glue--c69dc6ace936
  3. ./autogen.sh

  4. #指定系统安装路径、系统配置路径、库文件路径。
  5. ./configure --prefix=/usr/local/heartbeat --sysconfdir=/etc/heartbeat libdir=/usr/local/heartbeat/lib LIBS='/lib/libuuid.so.1'
  6. make && make install
* 64位环境需要将配置参数中的lib 更改为 lib64
* 安装过程中会从 sourceforge 下载一些文件,如果速度慢,需要检查网络是否畅通,以及 docbook-dtds docbook-style-xsl 两个rpm包是否安装。

        四、安装Resource Agents
             官方下载地址
  1. unzip master.zip
  2. cd ClusterLabs-resource-agents-b735277
  3. ./autogen.sh
  4. ./configure --prefix=/usr/local/heartbeat --sysconfdir=/etc/heartbeat libdir=/usr/local/heartbeat/lib CFLAGS=-I/usr/local/heartbeat/include LDFLAGS=-L/usr/local/heartbeat/lib LIBS='/lib/libuuid.so.1'
  5. ln -s /usr/local/heartbeat/lib/* /lib/
  6. make && make install

        进行make && make install编译的时候,出现了类似:
        error while loading shared libraries: libnet.so.9: cannot open shared object file: No such file or directory

        原因一般有两个, 一个是操作系统里确实没有包含该共享库(lib*.so.*文件)或者共享库版本不对, 遇到这种情况那就去网上下载并安装上即可. 
        另外一个原因就是已经安装了该共享库, 但执行需要调用该共享库的程序的时候, 程序按照默认共享库路径找不到该共享库文件. 
        所以安装共享库后要注意共享库路径设置问题, 如下:
            1) 如果共享库文件安装到了/lib或/usr/lib目录下, 那么需执行一下ldconfig命令
            ldconfig命令的用途, 主要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录下, 搜索出可共享的动态链接库(格式如lib*.so*), 进而创建出动态装入程序(ld.so)所需的连接和缓存文件. 缓存文件默认为/etc/ld.so.cache, 此文件保存已排好序的动态链接库名字列表. 
            2) 如果共享库文件安装到了/usr/local/lib(很多开源的共享库都会安装到该目录下)或其它"非/lib或/usr/lib"目录下, 那么在执行ldconfig命令前, 还要把新共享库目录加入到共享库配置文件/etc/ld.so.conf中, 如下:
cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig
3) 如果共享库文件安装到了其它"非/lib或/usr/lib" 目录下,  但是又不想在/etc/ld.so.conf中加路径(或者是没有权限加路径). 那可以export一个全局变量LD_LIBRARY_PATH, 然后运行程序的时候就会去这个目录中找共享库. 
export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH    
一般来讲这只是一种临时的解决方案, 在没有权限或临时需要的时候使用.
4)如果程序需要的库文件比系统目前存在的村文件版本低,可以做一个链接
比如:
error while loading shared libraries: libncurses.so.4: cannot open shared
object file: No such file or directory
ls /usr/lib/libncu*
/usr/lib/libncurses.a   /usr/lib/libncurses.so.5
/usr/lib/libncurses.so  /usr/lib/libncurses.so.5.3
可见虽然没有libncurses.so.4,但有libncurses.so.5,是可以向下兼容的
建一个链接就好了
ln -s  /usr/lib/libncurses.so.5.3  /usr/lib/libncurses.so.4

另一个问题是,在编译的过程中,出现了类似metadata -->ipv6 addr之类的东西,具体的没有截图,记不太清楚了,就是源代码编译有问题,请重新下载源代码,然后重新编译,它自己会从网站上下载一些东西,请注意网络的畅通。

五、
安装Heartbeat
官方下载地址

  1. tar jxf Heartbeat-3-0-7e3a82377fa8.tar.bz2
  2. cd Heartbeat-3-0-7e3a82377fa8
  3. ./bootstrap
  4. ./configure --prefix=/usr/local/heartbeat --sysconfdir=/etc/heartbeat CFLAGS=-I/usr/local/heartbeat/include LDFLAGS=-L/usr/local/heartbeat/lib64 LIBS='/lib64/libuuid.so.1'
  5. vi /usr/local/heartbeat/include/heartbeat/glue_config.h
  6. // 删除 glue_config.h 最后一行定义的配置文件路径,避免编译时产生的路径重复定义错误,Shift+g 跳到末行,dd删除
  7. // define HA_HBCONF_DIR "/usr/local/heartbeat/etc/ha.d/" :wq保存完成.
  8. make && make install
将配置文件复制到 /etc/heartbeat/ 下,并使用sed 修改路径

  1. cp doc/ha.cf /etc/heartbeat/ha.d/
  2. cp doc/haresources /etc/heartbeat/ha.d/
  3. cp doc/authkeys /etc/heartbeat/ha.d/
  4. chkconfig --add heartbeat
  5. chkconfig heartbeat on
  6. chmod 600 /etc/heartbeat/ha.d/authkeys
  7. sed -i 's#/usr/lib/ocf#/usr/local/heartbeat/usr/lib/ocf#g' /etc/heartbeat/ha.d/shellfuncs
  8. sed -i 's#/usr/lib/ocf#/usr/local/heartbeat/usr/lib/ocf#g' /etc/heartbeat/ha.d/resource.d/hto-mapfuncs
  9. sed -i 's#/usr/lib/ocf#/usr/local/heartbeat/usr/lib/ocf#g' /usr/local/heartbeat/usr/lib/ocf/lib/heartbeat/ocf-shellfuncs
Resource-Agent 的脚本软连接,避免Heartbeat 找不到路径而无法工作
        ln -s /usr/local/heartbeat/usr/lib/ocf /usr/lib/ocf

至此,Heartbeat三部分安装完毕!

一些小问题的解决方法:
1、文件为.bz2的解压缩命令是:

    tar -jxvf /mnt/cdrom/related_LVS/Heartbeat-3-0-7e3a82377fa8.tar.bz2 
    .zip文件的解压命令为unzip 111.zip


2、在编译heartbeat之前,需要有几个package自行安装,其中包括书中提到的per-MailTools,也包括在编译过程中报错,指定要安装的automake、libtool、tix、OPenIPMI、libxslt,直接使用yum安装即可。



阅读(2851) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~