2012年12月18日 星期二

heartbeat3.05安装

CentOS6.3
http://www.thatsgeeky.com/2011/07/installing-heartbeat-on-amazon%E2%80%99s-ec2/
http://www.linuxso.com/linuxrumen/6445.html
http://hi.baidu.com/_you_yan/item/aa08890d295709cf74cd3c24     the new
http://blog.csdn.net/lhfeng/article/details/5992116
http://www.wenzizone.cn/?tag=heartbeat
一、LVS安装
系统默认是支持LVS功能的(有如下信息表示支持)。
# modprobe -l |grep ipvs
kernel/net/netfilter/ipvs/ip_vs.ko
kernel/net/netfilter/ipvs/ip_vs_rr.ko
kernel/net/netfilter/ipvs/ip_vs_wrr.ko
kernel/net/netfilter/ipvs/ip_vs_lc.ko
kernel/net/netfilter/ipvs/ip_vs_wlc.ko
kernel/net/netfilter/ipvs/ip_vs_lblc.ko
kernel/net/netfilter/ipvs/ip_vs_lblcr.ko
kernel/net/netfilter/ipvs/ip_vs_dh.ko
kernel/net/netfilter/ipvs/ip_vs_sh.ko
kernel/net/netfilter/ipvs/ip_vs_sed.ko
kernel/net/netfilter/ipvs/ip_vs_nq.ko
kernel/net/netfilter/ipvs/ip_vs_ftp.ko
二、在Director Server上安装IPVS管理软件
首先从 http://www.linuxvirtualserver.org/software/ipvs.html 下载对应的IPVS源码
我这里下载 ipvsadm-1.24.tar.gz
安装方法一:(推荐用这个方便快捷):
# yum install -y ipvsadm
# ipvsadm --help  有相关信息输出,表时IPVS已经安装成功。
安装方法二:
# tar zxvf ipvsadm-1.24.tar.gz
# cd ipvsadm-1.24
# make
# make install
三、安装heartbeat
-----------------------------------------------
首先下载libnet工具,并安装
http://sourceforge.net/projects/libnet-dev/
# tar zxvf libnet-1.1.6.tar.gz
# cd libnet-1.1.6
# ./configure
# make
# make install
-----------------------------------------------
heartbeat下载并安装(三个文件:Heartbeat、Cluster Glue、Resource Agents)
http://linux-ha.org/wiki/Downloads
# yum -y install glib2-devel libtool-ltdl-devel net-snmp-devel bzip2-devel \
ncurses-devel openssl-devel libtool libxml2-devel gettext bison flex zlib-devel \
mailx which libxslt-devel docbook-dtds docbook-style-xsl PyXML shadow-utils opensp autoconf automake libuuid-devel \
libexslt libexslt-devel libgcrypt-devel pkgconfig libgpg-error-devel sgml-common opensp openjade xml-common \
docbook-dtds docboot-style -y 
1、安装Cluster Glue
# groupadd haclient
# useradd hacluster -g haclient -s /sbin/nologin
# tar jxvf Reusable-Cluster-Components-glue--glue-1.0.9.tar.bz2
# cd Reusable-Cluster-Components-glue--glue-1.0.9
# ./autogen.sh
# ./configure --prefix=/usr/local/ha_soft
# make
# make install
2、安装Resource Agents
# cd ../
# tar zxvf ClusterLabs-resource-agents-v3.9.2-0-ge261943.tar.gz
# cd ClusterLabs-resource-agents-b735277
# ./autogen.sh
# ./configure --prefix=/usr/local/ha_soft CFLAGS=-I/usr/local/ha_soft/include \
LDFLAGS=-L/usr/local/ha_soft/lib
# vi /usr/local/ha_soft/include/heartbeat/glue_config.h(找到如下几个设置项删除对应的行)
HA_SYSCONFDIR
HA_HBCONF_DIR
HA_HBCONF_DIR
# make
# vi /etc/ld.so.conf.d/heartbeat.conf (输入如下行)
/usr/local/ha_soft/lib
# ldconfig
# make install
3、安装heartbeat
# cd ..
# tar jxvf Heartbeat-3-0-7e3a82377fa8.tar.bz2
# cd Heartbeat-3-0-7e3a82377fa8
# ./bootstrap
# ./configure --prefix=/usr/local/ha_soft CFLAGS=-I/usr/local/ha_soft/include \
LDFLAGS=-L/usr/local/ha_soft/lib
# cp /srv/Heartbeat-3-0-7e3a82377fa8/lib/plugins/HBcomm/hbaping.c /srv/Heartbeat-3-0-STABLE-3.0.4/lib/plugins/HBcomm/hbaping.c.bak
# vi /srv/Heartbeat-3-0-STABLE-3.0.4/lib/plugins/HBcomm/hbaping.c(安装源码目录,删除326行)
# make
# make install
四、配置(节点1和节点2相同,区别就是检查ip是对方) ? 从源码编译目录中复制配置文件到安装目录
复制附件<配置文件>里的配置文件到 /usr/local/ha_soft/etc/ha.d/
编辑ha.cf 主配置文件
[root@aos ha.d]# cd /usr/local/ha_soft/etc/ha.d
[root@aos ha.d]# vim ha.cf
#debugfile /var/log/ha-debug
#logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 6
warntime 4
initdead 30
udpport 694
ucast eth1 192.168.1.200
auto_failback off
node aos
node weibo
compression bz2
compression_threshold 2
ping_group group1 xxxxx82 xxxx.80
respawn root /usr/local/ha_soft/lib/heartbeat/ipfail
apiauth ipfail gid=root uid=root
debug 0
? 编辑authkeys 验证信息文件
[root@aos ha.d]# cd /usr/local/ha_soft/etc/ha.d
[root@aos ha.d]# vim authkeys
auth 1
1 crc
[root@aos ha.d]# chmod 600 authkeys
? 编辑haresources 资源控制配置文件
[root@aos ha.d]# cd /usr/local/ha_soft/etc/ha.d
[root@aos ha.d]# vim haresources
aos IPaddr::xxxxx.70/25/eht0/xxxxx.127
? 链接文件
[root@aos heartbeat]# vim /etc/ld.so.conf(加入到文件末尾)
/usr/local/ha_soft/lib/
[root@aos heartbeat]# ldconfig
#cp /usr/local/ha_soft/etc/ha.d/resource.d/hto-mapfuncs /usr/local/ha_soft/etc/ha.d/resource.d/hto-mapfuncs.bak
[root@aos heartbeat]# vim +35 /usr/local/ha_soft/etc/ha.d/resource.d/hto-mapfuncs(注释35行)
(六) 注册并且启动服务
[root@aos ha.d]# chkconfig --add heartbeat
[root@aos ha.d]# chkconfig levles 2345 heartbeat on
[root@aos ha.d]# /etc/init.d/heartbeat start
-------------------------------------------------------------------
In file included from libipvs.c:23:
1.找到ip_vs.h文件.copy to /usr/include/net下
2.ln -s /usr/src/kernels/2.6.9-22.EL-i686/ /usr/src/linux
3.修改当前目录和libipvs目录中的Makefile的:
INCLUDE = -I/usr/src/linux/include -I.. -I.
为:
INCLUDE = -I/usr/src/kernels/2.6.9-22.EL-i686/include -I..-I.
---------------------------------------------------------------------
configure: error: You need glib2-devel installed in order to build cluster-glue
# yum install -y glib2-devel
----------------------------------------------------------------------
checking for special libxml2 includes... configure: error: libxml2 config not found
# yum install -y libxml2 libxml2-devel
-----------------------------------------------------------------------
configure: error: BZ2 libraries not found
yum -y install bzip2-devel glib2-devel
------------------------------------------------------------------------
gmake[2]: *** [hb_report.8] Error 4
这个报错因为要访问http://docbook.sourceforge.net/release/xsl/current/ 目录下的文件造成的,第一次发现源码安装软件需要联网,并且还要翻墙(^_^),本人水平有限,没办法直接翻墙。网页翻墙后下载common html lib manpages四个目录下的文件和VERSION.xsl,然后简易搭建一个httpd服务器,在主目录下新建相同的目录结构,并将所有文件拷贝到相应目录;然后在/etc/hosts文件中将docbook.sourceforge.net指向httpd的IP。(你知道这在干什么吧,做个假的 docbook.sourceforge.net服务器)
# vi /etc/mime.types  加入  xml  xsl  保存。
这里要多编译几次,有时候会提示找不到网页的。下载网页 wget -r A http://docbook.sourceforge.net/release/xsl/current/
约1个小时左右就下完了。
-------------------------------------------------------------------------
../heartbeat/IPv6addr: error while loading shared libraries: libplumb.so.2: cannot open shared object file: No such file or directory
gmake[2]: *** [metadata-IPv6addr.xml] Error 127
解决办法:这个是由于缺乏libplumb.so.2引起的,到网上libplumb.so.2下载包含这个文件的rpm即可,在本次方案中用的是libheartbeat2-2.99.2-6.1.i386.rpm
--------------------------------------------------------------------------
aclocal-1.5
automake-1.5 --add-missing --include-deps --copy
configure.in: 472: `AC_DECL_YYTEXT' is covered by `AM_PROG_LEX'
contrib/Makefile.am:23: SUBDIRS was already defined in condition TRUE, which implies condition BUILD_DRBD_OUTDATE_PEER_TRUE
  SUBDIRS (User, where = 23) +=
  {
    TRUE => ipfail mlock
  }
replace/Makefile.am:29: required file `replace/[lt__dirent].c' not found
replace/Makefile.am:29: required file `replace/[lt__strl].c' not found
replace/Makefile.am:29: required file `replace/[argz].c' not found
./bootstrap exiting due to error (sorry!).
解决办法:
yum update -y 慎用
yum groupinstall -y "Development Tools"
yum install -y wget net-snmp-devel openhpi-devel net-snmp OpenIPMI glib2-devel libxml2-devel bzip2-devel libuuid-devel docbook-utils docbook-dtds libtool-ltdl libtool-ltdl-devel libxslt perl-TimeDate python-devel OpenIPMI-devel openssl-devel docbook-style-xsl help2man e2fsprogs-devel mailx
---------------------------------------------------------------------------------------
metadata-IPv6addr.xml:1: parser error : Document is empty
^
metadata-IPv6addr.xml:1: parser error : Start tag expected, '<' not found
^
unable to parse metadata-IPv6addr.xml
gmake[2]: *** [ocf_heartbeat_IPv6addr.xml] Error 6
gmake[2]: Leaving directory `/home/soft/ClusterLabs-resource-agents-b735277/doc'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/soft/ClusterLabs-resource-agents-b735277'
make: *** [all] Error 2
解决办法:xml 没有下载成功,重头开始安装编译。
------------------------------------------------------------------------------------
../heartbeat/IPv6addr: error while loading shared libraries: libnet.so.1: cannot open shared object file: No such file or directory
gmake[2]: *** [metadata-IPv6addr.xml] Error 127
# yum install libnet*  不知道是不是这样解决的,反正重新编译可以了。

沒有留言:

張貼留言