1.測試環境
操做系統:CentOS6.5
director:
eth0,VIP:172.16.100.1
eth1,DIP:192.168.220.110(hostonly)
realserver1:192.168.220.111(hostonly)
realserver2:192.168.220.112(hostonly)
2.realserver配置
1).安裝須要配置成集羣服務的服務
2).配置realserver默認網關指向DIP
3.director安裝與配置
1).安裝ipvsadm
bash
yum install ipvsadm -y
2).打開網卡間轉發
ide
echo 1 > /proc/sys/net/ipv4/ip_forward
3).添加ipvs規則
測試
ipvsadm -A -t 172.16.100.1:80 -s rr #添加集羣服務 ipvsadm -a -t 172.16.100.1:80 -r 192.168.220.111 -m -w 2 #添加realserver ipvsadm -a -t 172.16.100.1:80 -r 192.168.220.112 -m -w 3
注:在實際環境中各節點的時間應該同步。
操作系統