一,实现DR模型搭建
1, 负载调度器配置
1.1调整ARP参数
vim /etc/sysctl.conf
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.ens33.send_redirects = 0
sysctl -p
1.2 配置虚拟IP地址重启网卡
cd /etc/sysconfig/network-scripts/
cp ifcfg-ens33 ifcfg-ens33:0
systemctl restart network
1.3 安装ipvsadm
yum install -y ipvsadm
1.4 加载ip_vs模块
modprobe ip_vs
lsmod |grep ip_vs
1.5 启动ipvsadm服务
创建文件touch /etc/sysconfig/ipvsadm
systemctl start ipvsadm
1.6 配置负载分配策略
ipvsadm -A -t 192.168.115.200:80 -s rr
ipvsadm -a -t 192.168.115.200:80 -r 192.168.115.4:80 -g
ipvsadm -a -t 192.168.115.200:80 -r 192.168.115.5:80 -g
1.7 保存策略
ipvsadm-save > /etc/sysconfig/ipvsadm
2, web节点配置
1.1 调整ARP参数
vim /etc/sysctl.conf
net.ipv4.conf.all.arp_ignore=1
net.ipv4.conf.all.arp_announce=2
net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce=2
sysctl -p
1.2 配置虚拟IP地址
cd /etc/sysconfig/network-scripts/
cp ifcfg-lo ifcfg-lo:0
vim ifcfg-lo:0
1.3添加回环路由
route add -host 192.168.115.200/32 dev lo:0
1.4安装nginx并写入文件
1.5 网站查看