实验准备:
开启3台虚拟机,配置好yum源
server1 172.25.35.1(调度服务器)
server2 172.25.35.2(后台服务器)
server3 172.25.35.3(后台服务器)
###server1(调度服务器)
1.安装ipvsadm
yum install -y ipvsadm
2.开启ipvsadm服务
touch /etc/sysconfig/ipvsadm
systemctl start ipvsadm.service
systemctl status ipvsadm.service
3.添加策略
ipvsadm -A -t 172.25.35.100:80 -s rr ##调度策略为rr轮询算法
ipvsadm -a -t 172.25.35.100:80 -r 172.25.35.2:80 -g ##添加两个后端服务器rs
ipvsadm -a -t 172.25.35.100:80 -r 172.25.35.3:80 -g
cat /etc/sysconfig/ipvsadm ##直接查看文件,策略不生效
systemctl restart ipvsadm.service
cat /etc/sys