免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2060 | 回复: 0
打印 上一主题 下一主题

linux-ha在redhat 4.2上稳定版本heartbeat 2.0.4的安装 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-22 14:05 |只看该作者 |倒序浏览

1、redhat4.2安装,安装开发包;
2、安装ipvsadm
rpm -ivh ipvsadm-1.24-5.i386.rpm

3、安装heartbeat
rpm -ivh heartbeat-pils-2.0.4-1.el4.i386.rpm
rpm -ivh heartbeat-stonith-2.0.4-1.el4.i386.rpm
rpm -ivh heartbeat-2.0.4-1.el4.i386.rpm
rpm -ivh perl-Parse-RecDescent-1.94-1.rh.el.um.1.noarch.rpm
rpm -ivh perl-Mail-IMAPClient-2.2.9-1.rh.el.um.1.noarch.rpm
rpm -ivh perl-Digest-SHA1-2.07-5.i386.rpm
rpm -ivh perl-Digest-HMAC-1.01-13.noarch.rpm
rpm -ivh perl-Net-DNS-0.48-1.i386.rpm
rpm -ivh perl-Authen-SASL-2.08-1.rh.el.um.1.noarch.rpm
rpm -ivh perl-Net-SSLeay-1.25-3.2.el4.rf.i386.rpm
rpm -ivh perl-IO-Socket-SSL-0.96-1.rh.el.um.1.noarch.rpm
rpm -e perl-LDAP
rpm -ivh perl-ldap-0.3202-1.rh.el.um.1.noarch.rpm
rpm -ivh perl-modules-5.8.5-3.i386.rpm
rpm -ivh --force perl-libnet-1.19-3.noarch.rpm  ##(用force的原因:安装包中man3里有10个文件与包perl.5.8.5-16中的相同)
rpm -ivh heartbeat-ldirectord-2.0.4-1.el4.i386.rpm

导向服务器角色所需软件包安装完毕
所有软件包见附件

1.    HA配置,ldirector配置
场景:
   群集公共地址         vip=192.168.2.3
   群集ha节点1(主): 主机名mxb6    eth0=192.168.2.6/24        eth1=192.168.3.6/24
   群集ha节点2(备): 主机名mxb7   eth0=192.168.2.7/24        eth1=192.168.3.7/24

   真实应用服务器1: eth0=192.168.2.20/24                lo:0=192.168.2.5/32
   真实应用服务器2: eth0=192.168.2.21/24                lo:0=192.168.2.5/32
配置
ha配置文件样例在/usr/share/doc/heartbeat-2.0.4目录里
将文件ha.cf,haresource,authkey文件复制到 /etc/ha.d/
ldirectord样例文件在/usr/share/doc/heartbeat-ldirectord-2.0.4目录
将ldirectord.cf复制到/etc/ha.d/
然后按下面的内容进行配置.

编辑所有主机的/etc/hosts文件
127.0.0.1               localhost.localdomain localhost
192.168.2.6     mxb6
192.168.2.7     mxb7
192.168.2.20    mxb20
192.168.2.21    mxb21
192.168.2.22    mxb22
192.168.2.3     vip
群集ha1节点1配置
执行命令:
chkconfig --del ldirectord
chkconfig --level 2345 heartbeat on

编辑/etc/ha.d/ha.cf
logfile /var/log/ha-log
logfacility     local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
#baud    19200
#serial /dev/ttyS0
bcast   eth1
ucast eth1 192.168.3.7 #另一个节点的
auto_failback on
node    mxb6
node    mxb7
ping 192.168.2.1

修改/etc/ha.d/authkeys 文件权限 600
chmod 600 /etc/ha.d/authkeys
编辑内容为:
auth 1
1 crc
#2 sha1 HI!
#3 md5 Hello!

编辑/etc/ha.d/haresources
mxb6   IPaddr::192.168.2.3/24/eth0/192.168.2.255 ldirectord::ldirectord.cf LVSSyncDaemonSwap::master

编辑/etc/ha.d/ldirectord.cf
# Global Directives
checktimeout=1
checkinterval=1
#fallback=127.0.0.1:80
autoreload=yes
logfile="/var/log/ldirectord.log"
#logfile="local0"
quiescent=yes
# A sample virual with a fallback that will override the gobal setting
virtual=192.168.2.3:80
        real=192.168.2.20:80 gate w 5
        real=192.168.2.21:80 gate w 5
        real=192.168.2.22:80 gate w 5
#         fallback=127.0.0.1:80 gate
        service=http
        checkport=80
        request="index.html"
        receive="Test Page"
#        virtualhost=rs.net
        scheduler=rr
        #persistent=600
        #netmask=255.255.255.255
        protocol=tcp

编辑/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mxb6

编辑/etc/sysctl.conf
net.ipv4.ip_forward = 0

群集ha1节点2配置
执行命令:
chkconfig --del ldirectord
chkconfig --level 2345 heartbeat on

编辑/etc/ha.d/ha.cf
logfile /var/log/ha-log
logfacility     local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
#baud    19200
#serial /dev/ttyS0
bcast   eth1
ucast eth1 192.168.3.6 #另一个节点的
auto_failback on
node    mxb6
node    mxb7
ping 192.168.2.1

修改/etc/ha.d/authkeys 文件权限 600
chmod 600 /etc/ha.d/authkeys
编辑内容为:
auth 1
1 crc
#2 sha1 HI!
#3 md5 Hello!

编辑/etc/ha.d/haresources
mxb6        IPaddr::192.168.2.3/24/eth0/192.168.2.255 ldirectord::ldirectord.cf LVSSyncDaemonSwap::master

编辑/etc/ha.d/ldirectord.cf
# Global Directives
checktimeout=1
checkinterval=1
#fallback=127.0.0.1:80
autoreload=yes
logfile="/var/log/ldirectord.log"
#logfile="local0"
quiescent=yes
# A sample virual with a fallback that will override the gobal setting
virtual=192.168.2.3:80
        real=192.168.2.20:80 gate w 5
        real=192.168.2.21:80 gate w 5
        real=192.168.2.22:80 gate w 5
#         fallback=127.0.0.1:80 gate
        service=http
        checkport=80
        request="index.html"
        receive="Test Page"
#        virtualhost=rs.net
        scheduler=rr
        #persistent=600
        #netmask=255.255.255.255
        protocol=tcp

编辑/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mxb6

编辑/etc/sysctl.conf
net.ipv4.ip_forward = 0

真实应用服务器节点1(下面设置每个服务器都一样)
编辑/etc/sysctl.conf,填加下面4行
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2

编辑/etc/sysconfig/network-script/ifcfg-lo:0
DEVICE=lo:0
IPADDR=192.168.2.3
NETMASK=255.255.255.255
NETWORK=192.168.2.3
ONBOOT=yes
ARP=no

配置apache
新建index.html文件,内容为"Test Page",能够通过 http://192.168.2.6/index.html访问


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/21174/showart_2127910.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP