##########################
######## DR #######
##########################
实验一:
server4,server5
/etc/init.d/heartbeat stop
yum install -y ldirectord-3.9.5-3.1.x86_64.rpm
server4
cd /usr/share/doc/ldirectord-3.9.5/
cp ldirectord.cf /etc/ha.d/
yum install repolist
yum install ipvsadm -y
ipvsadm -L
ipvsadm -A -t 172.25.24.198:80 -s rr
ip addr add 172.25.24.198/24 dev eth0
ipvsadm -a 172.25.24.198:80 -r 172.25.24.2:80 -g
[root@server4 ~]# ipvsadm -a -t 172.25.24.198:80 -r 172.25.24.2:80 -g
[root@server4 ~]# ipvsadm -a -t 172.25.24.198:80 -r 172.25.24.3:80 -g
[root@server4 ~]# ipvsadm -l
[root@server4 ~]# /etc/init.d/ipvsadm save
server2
[root@server2 ~]# /etc/init.d/httpd start
[root@server2 ~]# ip addr add 172.25.24.198/32 dev eth0
[root@server2 ~]# vim /etc/httpd/conf/httpd.conf [listen:80]
[root@server2 ~]# yum install arptables
[root@server2 ~]# arptables -A IN -d 172.25.24.198 -j DROP
[root@server2 ~]# arptables -A OUT -s 172.25.24.198 -j mangle --mangle-ip-s 172.25.24.2
[root@server2 ~]# /etc/init.d/arptables_jf save
[root@server2 ~]# vim /etc/sysconfig/arptables
server3
[root@server3 ~]# /etc/init.d/httpd start
[root@server3 ~]# ip addr add 172.25.24.198/32 dev eth0
[root@server3 ~]# vim /etc/httpd/conf/httpd.conf
[root@server3 ~]# /etc/init.d/httpd restart
[root@server3 ~]# yum install -y arptables_jf.x86_64
[root@server3 ~]# arptables -A IN -d 172.25.24.198 -j DROP
[root@server3 ~]# arptables -A OUT -s 172.25.24.198 -j mangle --mangle-ip-s 172.25.24.3
[root@server3 ~]# /etc/init.d/arptables_jf save
测试:
###############
实验二:
server4
vim ldirectord.cf
/etc/init.d/ldirectord start
ip addr del 172.25.24.198/24 dev eth0
vim haresources
scp haresources ldirectord.cf 172.25.24.5:/etc/ha.d/
/etc/init.d/ldirectord start
/etc/init.d/ldirectord stop
/etc/init.d/heartbeat start
/etc/init.d/heartbeat stop