ipvsadm nat模式配置
echo "1" >/proc/sys/net/ipv4/ip_forward
清空配置
ipvsadm -C
添加规则
ipvsadm -A -t 192.168.10.135:80 -s rr
ipvsadm -a -t 192.168.10.135:80 -r 172.16.6.12:80 -m
ipvsadm -a -t 192.168.10.135:80 -r 172.16.6.13:80 -m
查看配置
ipvsadm -L -n
保存配置
ipvsadm -S > /etc/sysconfig/ipvsadm
修改调度算法;
ipvsadm -E -t 192.168.10.135:80 -s sh
从保存的配置文件中重读配置
ipvsadm -C
ipvsadm -R < /etc/sysconfig/ipvsadm
ipvsadm -L -n
删除
ipvsadm -D -t 192.168.10.135:80
ipvsadm dr模型配置
(1)、LVS-server配置
a. VIP设置:
eth0:ip 192.168.0.101
ifconfig eth0:0 192.168.0.100 netmask 255.255.255.255
route add -host 192.168.0.100 dev eth0:0
b.安装Ipvsadm
yum -y install ipvsadm*
c.lvs配置:
ipvsadm -C
ipvsadm -At 192.168.0.100:80 -s rr
ipvsadm -at 192.168.0.100:80 -r 192.168.0.102:80 -g
ipvsadm -at 192.168.0.100:80 -r 192.168.0.103:80 -g
ipvsadm -L -n
(2)、Real-Server1配置
eth0:ip 192.168.0.102
ifconfig lo:0 192.168.0.100 netmask 255.255.255.255
route add -host 192.168.0.100 dev lo:0
echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce
(3)、Real-Server2配置
eth0:ip 192.168.0.103
ifconfig lo:0 192.168.0.100 netmask 255.255.255.255
route add -host 192.168.0.100 dev lo:0
echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce
持久连接的实现方式;
每端口持久;PPC,单服务持久调度
每FWM持久,PFWMC,单FWM持久调度
每客服端持久;PCC,单客户端持久调度
director会将用户的任何请求都识别为集群服务,并向RS进行调度
tcp:1-65535
udp:1-65535
所有的端口请求都调度到后端服务器
ipvsadm -A -t 192.168.0.10:0 -s rr -p
HA
director:高可用集群
realserver:让director对其做健康状态监测,并且根据监测结果自动
完成添加或移除等管理功能。
1.基于协议层次检查;
ip:icmp
传输层:检查端口的开放状态
应用层;请求获取关键性的资源
2.检查频度
3.状态判断
下线:ok-->failure-->failure-->failure
上线:failure-->ok-->ok
4.back server,sorry server