说明
- 只完成了在CentOS上编辑安装的部份,针对需求LVS调度、健康检查的需求heartbeat配置过于繁杂、而且没看出优势,用Keepalived+LVS显得直接、有效。
- heartbeat 3拆分为几个组件,其中resource-agents分至另外项目,结构变化较大,网上找到的大多相关文章均显得过时。
- RedHat 6取消了heartbeat,Redhat/CentOS都无法通过yum直接安装。
- RedHat 6中增加Pacemaker包,未研究其使用方法。
Heartbeat编译安装
Update: 2012-11-29
参考
- CentOS 6.2(RHEL6)高可用服务器环境搭建: http://www.linuxidc.com/Linux/2012-06/62047.htm
- LVS双机热备和负载均衡一体化安装方法: http://www.tuicool.com/articles/vaAjQf
测试环境
- CentOS 6.3 2.6.32-279.el6.i686
- Red Hat Enterprise Linux Server release 6.0 (Santiago),2.6.32-71.el6.x86_64
Red Hat通过CentOS源来安装一些支持包。
yum安装编译环境支持包及ipvsadm
yum -y install unzip wget gcc autoconf automake make libtool pkgconfig glib2-devel \ libxml2 libxml2-devel bzip2-devel libtool-ltdl-devel libuuid-devel libxslt-devel; yum -y install ipvsadm kernel-devel; yum -y install perl-Socket6 perl-libwww-perl perl-IO-Socket-INET6 perl-MailTools; yum -y install docbook-*;
下载源码相应包
mkdir -p ~/down && cd ~/down wget http://hg.linux-ha.org/glue/archive/glue-1.0.9.tar.bz2 wget https://github.com/ClusterLabs/resource-agents/zipball/master -O ClusterLabs-resource-agents.zip --no-check-certificate wget -O heartbeat-STABLE_3_0_5.tar.bz2 http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/7e3a82377fa8.tar.bz2
编译glue
groupadd haclient useradd -g haclient -M -s /sbin/nologin hacluster cd ~/down \ && tar jxvf glue-1.0.9.tar.bz2 \ && cd Reusable-Cluster-Components-glue--glue-1.0.9 \ && ./autogen.sh \ && ./configure \ && make \ && make install \ && cd -
resource-agents
# yum install perl-Socket6 perl-libwww-perl perl-IO-Socket-INET6 perl-MailTools; # yum install docbook-*; cd ~/down \ && unzip ClusterLabs-resource-agents.zip \ && cd ClusterLabs-resource-agents-3c93e36/ \ && ./autogen.sh \ && ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ && make && make install \ && cp ldirectord/ldirectord.cf /etc/ha.d/ \ && cd - # 以下复制操作在make install中已完成 # cp ldirectord/ldirectord /usr/sbin/ # cp ldirectord/init.d/ldirectord /etc/init.d/ # chmod 755 /usr/sbin/ldirectord # chmod 755 /etc/init.d/ldirectord # cp ldirectord/ldirectord.cf /etc/ha.d/ # vi /etc/ha.d/ldirectord.cf;
编译Heartbeat 3
# yum install perl-Socket6 perl-libwww-perl perl-IO-Socket-INET6 perl-MailTools; cd ~/down \ && tar jxvf heartbeat-STABLE_3_0_5.tar.bz2 \ && cd Heartbeat-3-0-7e3a82377fa8 \ && ./bootstrap \ && ./ConfigureMe configure \ && make && make install \ && cd - cp /usr/share/doc/heartbeat/authkeys /etc/ha.d/ cp /usr/share/doc/heartbeat/haresources /etc/ha.d/ cp /usr/share/doc/heartbeat/ha.cf /etc/ha.d/ chmod 600 /etc/ha.d/authkeys ln -sfT /etc/ha.d /usr/etc/ha.d
下载第三方包方式安装ldirectord
未测试,建议编译安装方式
wget http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Everything/x86_64/os/Packages/l/ldirectord-3.9.2-2.fc17.1.x86_64.rpm yum install ipvsadm perl-MailTools perl-Net-SSLeay -y rpm -ivh ldirectord-3.9.2-2.fc17.1.x86_64.rpm rpm -ql ldirectord /etc/ha.d /etc/ha.d/resource.d /etc/ha.d/resource.d/ldirectord /etc/init.d/ldirectord /etc/logrotate.d/ldirectord /usr/lib/ocf/resource.d/heartbeat/ldirectord /usr/sbin/ldirectord /usr/share/doc/ldirectord-3.9.2 /usr/share/doc/ldirectord-3.9.2/COPYING /usr/share/doc/ldirectord-3.9.2/ldirectord.cf /usr/share/man/man8/ldirectord.8.gz