前提: 1.关闭iptables 防火墙 2. 关闭SELinux
#安装 ipvsadm
rpm -ivh ipvsadm-1.24-6.i386.rpm
#安装PHP (Disk 2)
rpm -ivh curl-7.12.1-8.rhel4.i386.rpm
rpm -Uvh php-4.3.9-3.15.i386.rpm php-pear-4.3.9-3.15.i386.rpm
#安装piranha
rpm -ivh piranha-0.8.3-1.i386.rpm
Piranha 配置工具默認在端口 3636 上運行。要改變這個端口號碼,改變 piranha-gui 萬維網伺服器配置文件 /etc/sysconfig/ha/conf/httpd.conf 的第二部分的 Listen 3636 這一行。
ref: http://218.9.77.66:89/gate/big5/www.chinahrb.com/book/redhatas3_cluster/s1-lvs-piranha-service.html
配置转发
#查看当前设置
/sbin/sysctl net.ipv4.ip_forward
如果以上命令返回了 1,那麼 IP 轉發就被啟用了。如果它返回了 0,那麼你需要使用以下命令來手工啟用它
arptables -A IN -d $VIP -j DROP
arptables -A OUT -s $VIP -j mangle --mangle-ip-s $RIP
ref:http://kb.linuxvirtualserver.org/wiki/Using_arptables_to_disable_ARP
#安装 ipvsadm
rpm -ivh ipvsadm-1.24-6.i386.rpm
#安装PHP (Disk 2)
rpm -ivh curl-7.12.1-8.rhel4.i386.rpm
rpm -Uvh php-4.3.9-3.15.i386.rpm php-pear-4.3.9-3.15.i386.rpm
#安装piranha
rpm -ivh piranha-0.8.3-1.i386.rpm
Piranha 配置工具默認在端口 3636 上運行。要改變這個端口號碼,改變 piranha-gui 萬維網伺服器配置文件 /etc/sysconfig/ha/conf/httpd.conf 的第二部分的 Listen 3636 這一行。
ref: http://218.9.77.66:89/gate/big5/www.chinahrb.com/book/redhatas3_cluster/s1-lvs-piranha-service.html
配置转发
#查看当前设置
/sbin/sysctl net.ipv4.ip_forward
如果以上命令返回了 1,那麼 IP 轉發就被啟用了。如果它返回了 0,那麼你需要使用以下命令來手工啟用它
/sbin/sysctl -w net.ipv4.ip_forward=1
ref:http://218.9.77.66:89/gate/big5/www.chinahrb.com/book/redhatas3_cluster/s1-lvs-forwarding.html
配置LVS(DR)
ARP冲突解决
vi /etc/sysctl.conf
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
仅修改vi /etc/sysctl.conf不能完全解决arp冲突的问题,使用arping可以看到返回多个地址
用arptables 可以成功解决此问题
Disable ARP for VIP
Basically, we have the following commands to disable ARP for VIP at real servers.
arptables -Farptables -A IN -d $VIP -j DROP
arptables -A OUT -s $VIP -j mangle --mangle-ip-s $RIP
ref:http://kb.linuxvirtualserver.org/wiki/Using_arptables_to_disable_ARP