marty001 发表于 2019-1-7 08:47:01

Debian5.0 实现RAS双机 集群Heartbeat (一)

Debian5.0 双机实验手册
弄了一天了终于搞定了,好了废话不多说尽情享受吧http://blog.运维网.com/editor/icons/etc_17.gif

一、概述:
系统:debian5.0
集群软件:Heartbeat
服务器Lb1(主): IP:192.168.2.222
服务器Lb2(从): IP:192.168.4.222
虚拟IP :192.168.5.222
二、下载安装软件包和配置:
lb1/lb2:
1、需要以下软件包:aptitude install heartbeat


2、在lb1和lb2服务器上配置heartbeat,需要有以下三个文件:
authkeys、ha.cf、haresources,它们存在于/etc/ha.d/目录里。


3. 创建以上提到的三个文件:
lb1/lb2: 我们需要从/usr/share/doc/heartbeat目录下拷贝authkeys、ha.cf、haresources三个文件到/etc/ha.d/目录下面。

Lb1:/etc/ha.d# cp /usr/share/doc/heartbeat/authkeys/etc/ha.d/
Lb1:/etc/ha.d# cp /usr/share/doc/heartbeat/ ha.cf.gz/etc/ha.d/
Lb1:/etc/ha.d# cp /usr/share/doc/heartbeat/ haresources.gz/etc/ha.d/
Lb1:/etc/ha.d# gunzip ha.cf.gz
Lb1:/etc/ha.d# haresources.gz

Lb2:/etc/ha.d# cp /usr/share/doc/heartbeat/authkeys/etc/ha.d/
Lb2:/etc/ha.d# cp /usr/share/doc/heartbeat/ ha.cf.gz/etc/ha.d/
Lb2:/etc/ha.d# cp /usr/share/doc/heartbeat/ haresources.gz/etc/ha.d/
Lb2:/etc/ha.d# haresources.gz
Lb2:/etc/ha.d# gunzip ha.cf.gz



4、配置:
4.1、首先编辑authkeys文件:
lb1/lb2:
vi /etc/ha.d/authkeys

#1 crc
#2 sha1 HI!
3 md5 Hello!#这里选择md5加密 密码为Hello!



lb1/lb2:
chmod 600 /etc/ha.d/authkeys

lb1:
vi /etc/ha.d/ha.cf

#
#       keepalive: how many seconds between heartbeats
#
keepalive 2
#
#       deadtime: seconds-to-declare-host-dead
#
deadtime 10

#       What UDP port to use for udp or ppp-udp communication?
#
logfile /var/log/ha-log
udpport      694
bcasteth0
mcast eth0 225.0.0.1 694 1 0
ucast eth0 192.168.4.222
#       What interfaces to heartbeat over?
udp   eth0
#
#       Facility to use for syslog()/logger (alternative to log/debugfile)
#
logfacility   local0
#
#       Tell what machines are in the cluster
#       node    nodename ...    -- must match uname -n
node    lb1.example.com
node    lb2.example.com




注意:
ucastIP指向为另外一台lb2服务器192.168.4.222 (lb2.example.com).
lb2:
vi /etc/ha.d/ha.cf

#
#       keepalive: how many seconds between heartbeats
#
logfile /var/log/ha-log

keepalive 2
#
#       deadtime: seconds-to-declare-host-dead
#
deadtime 10
#
#       What UDP port to use for udp or ppp-udp communication?
#
udpport      694
bcasteth0
mcast eth0 225.0.0.1 694 1 0
ucast eth0 192.168.2.222
#       What interfaces to heartbeat over?
udp   eth0
#
#       Facility to use for syslog()/logger (alternative to log/debugfile)
#
logfacility   local0
#
#       Tell what machines are in the cluster
#       node    nodename ...    -- must match uname -n
node    lb1.example.com
node    lb2.example.com



lb1/lb2:

vi /etc/ha.d/haresources

lb1.example.com 192.168.5.222



lb1/lb2:
/etc/init.d/heartbeat start


如何检查是否开启。
Lb1:
发现多了eht0:0说明已经正常启动
ifconfig

http://blog.运维网.com/attachment/201004/201004101270887799776.png

lb2:
而lib2服务器没有显示虚拟IP
ifconfig

http://blog.运维网.com/attachment/201004/201004101270887811585.png
下文在Debian5.0 实现RAS双机 集群 (二)http://steven2.blog.运维网.com/855881/293430



页: [1]
查看完整版本: Debian5.0 实现RAS双机 集群Heartbeat (一)