|
Apache+heartbeat HA宕机自动切换到slave提供服务。
1:
http://www.linux-ha.org/download/ #:
http://libnet.sourceforge.net/
http://www.packetfactory.net/libnet/
2安装
tar xvf /mnt/libnet.tar.gz -C /usr/src/ ①
tar xvf /mnt/heartbeat-2.0.8.tar.gz -C /usr/src
cd /usr/src/libnet/
./configure &&make &&make install
cd ../heartbeat-2.0.8
./ConfigureMe configure &&make&&make install
groupadd -g 694 haclient
useradd -u 694 -g haclient hacluster
以下为不装libnet)用rpm、copy :资源文档,包括heartbeat、文件配置
下都一样
1)ha.cf
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 5
warntime 3
initdead 10
udpport 694
bcast eth1 # Linux
auto_failback on
watchdog /dev/watchdog
node ha01
node ha02
3验证等级,由低到高!!!
3先启动后,再启动slave)service heartbeat start
Starting High-Availability services:
2009/02/12_23:57:57 INFO: Resource is stopped
[ OK ]
、测试
1正常
[/td][/tr][tr][td=1,1,189]无eth0服务
[/td][td=1,1,189]打开192.168.58.100宕机
[/td][/tr][tr][td=1,1,189]:0
[/td][td=1,1,189]eth0服务
[/td][td=1,1,189]打开192.168.58.100恢复
[/td][/tr][tr][td=1,1,189]无eth0服务
[/td][td=1,1,189]打开192.168.58.100由于设备简陋只能人工估计。多次中断测试初步估计主机备机切换时间不足30断网测试
[table][tr][td=3,1,568]测试命令
[/td][td=1,1,189]ha01
[/td][td=1,1,189]ha02
[/td][/tr][tr][td=1,1,189] ifconfig
[/td][td=2,1,379]有httpd能同时打开 192.168.58.100第三方机器测试:
ping 192.168.58.100 地址
Interface: 192.168.58.1 --- 0x2
Internet Address Physical Address Type
192.168.58.100 00-0c-29-a5-e7-a4 dynamic
192.168.58.101 00-0c-29-a5-e7-a4 dynamic
192.168.58.102 00-0c-29-ec-f2-1f dynamic
107断网测试
[table][tr][td=3,1,568]测试命令
[/td][td=1,1,189]ha01
[/td][td=1,1,189]ha02
[/td][/tr][tr][td=1,1,189] ifconfig
[/td][td=2,1,379]eth0服务
[/td][td=1,1,189]都打不开
(ha01技术,两个或两个以上网卡虚拟出一个网卡。
的eth0),提高端口一的数据吞吐能力
2天,大大降低故障出现率。
绑定网卡请参见bond:(测试)
改为eth0
cat /etc/ha.d/ha.cf |grep -v "^#" :ucast eth0 192.168.58.102
Slave网段数据包:
tcpdump -i eth1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
优点:
不需要添加新网卡,可以直接将机器上的双网卡绑定。
eth0 、数据存储
1添加一台NFS drbd |
|
|