高可用群集HA的DR+heartbeat+ldirector配置
高可用群集HA的heartbeat+ldirector配置简要说明:heartbeat可是director起到备份高可靠性作用,ldirector可自动调用资源,也起到提高可靠性的作用。
要求:通过heartbeat和ldirector的结合,实现web服务器的访问。
http://blog.运维网.com/attachment/201212/165833278.png
一、director1的配置
上传所需包如下
http://blog.运维网.com/attachment/201212/165859185.png
安装所需rpm包
#yum localinstall heartbeat-2.1.4-9.el5.i386.rpm heartbeat-pils-2.1.4-10.el5.i386.rpm heartbeat-stonith-2.1.4-10.el5.i386.rpm libnet-1.1.4-3.el5.i386.rpm perl-MailTools-1.77-1.el5.noarch.rpm heartbeat-ldirectord-2.1.4-9.el5.i386.rpm -y –nogpgcheck
修改host文件
http://blog.运维网.com/attachment/201212/165949411.png
# hostname node1.a.com
# vim /etc/sysconfig/network
http://blog.运维网.com/attachment/201212/170009779.png
编辑三个文件
# cd /usr/share/doc/heartbeat-2.1.4/
# cp -p ha.cf authkeys haresources /etc/ha.d/
# cd /etc/ha.d
修改配置文件
# vim ha.cf //添加以下内容
bcast eth1
node node1.a.com
node node2.b.com
修改验证文件,首先产生随机数
http://blog.运维网.com/attachment/201212/170147801.png
# vim authkeys //添加以下内容
auth 3
3 md5 56c2ca909c6065fe9f4f6a0621cbe0e7
# chmod 600 authkeys
修改资源文件
# vim haresources //添加以下内容
node1.a.com 192.168.145.101/24/eth0ldirectord::ldirectord.cf
修改ldirectord.cf文件
# cp /usr/share/doc/heartbeat-ldirectord-2.1.4/ldirectord.cf/etc/ha.d/
# vim /etc/ha.d/ldirectord.cf
http://blog.运维网.com/attachment/201212/170318543.png
# service heartbeat start
注:安装启用ipvsadm
二、director2配置与director1配置相同,不再详述,可以把director2上的配置文件直接复制到director1上。
三、Real Server1的配置
httpd服务器的安装启动(不再详述)
地址配置如下
http://blog.运维网.com/attachment/201212/170723458.png
# route add -host 192.168.145.101 dev lo:0
# route –n //查看路由表
http://blog.运维网.com/attachment/201212/170737498.png
# sysctl -a |grep arp //查看arp工具
http://blog.运维网.com/attachment/201212/170814699.png
把上面两句话追加的/etc/sysctl.conf文件中
# echo "net.ipv4.conf.eth0.arp_ignore = 1" >>/etc/sysctl.conf
# echo "net.ipv4.conf.all.arp_ignore = 1" >>/etc/sysctl.conf
# echo "net.ipv4.conf.eth1.arp_announce = 2" >>/etc/sysctl.conf
# echo "net.ipv4.conf.all.arp_announce = 2" >>/etc/sysctl.conf
# sysctl –p 查看追加结果
# echo "I am ok" >/var/www/html/.test.html //创建探测文件
四、Real Server2的配置
地址配置如下
http://blog.运维网.com/attachment/201212/171003897.png
说明:其他配置和Real Server1一样,不再详述
查看加载资源情况
http://blog.运维网.com/attachment/201212/171030483.png
http://blog.运维网.com/attachment/201212/171050782.png
查看访问结果
http://blog.运维网.com/attachment/201212/171112332.png
http://blog.运维网.com/attachment/201212/171126154.png
如果关掉其中一台服务器(模拟故障)查看资源调用情况
http://blog.运维网.com/attachment/201212/171149654.png
有关Real Server1的规则自动消失。
页:
[1]