1、Director配置
firewall-cmd --state
systemctl stop firewalld
firewall-cmd --state
systemctl disable firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
yum -y install ipvsadm
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p
ifconfig eno16777736:0 192.168.6.102/24
ipvsadm -A -t 192.168.6.102:80 -s rr
ipvsadm -a -t 192.168.6.102:80 -r 192.168.60.101 -m
ipvsadm -a -t 192.168.6.102:80 -r 192.168.60.102 -m
ipvsadm -L -n
2、RS1配置
firewall-cmd --state
systemctl stop firewalld
firewall-cmd --state
systemctl disable firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
yum -y install httpd
echo "<h1> RS1 <h1>" >> /var/www/html/index.html
service httpd start
3、RS2配置
firewall-cmd --state
systemctl stop firewalld
firewall-cmd --state
systemctl disable firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
yum -y install httpd
echo "<h1> RS2 <h1>" >> /var/www/html/index.html
service httpd start
4、测试
[root@host ~]# curl 192.168.6.102
<h1> RS1 <h1>
[root@host ~]# curl 192.168.6.102
<h1> RS2 <h2>
[root@host ~]# curl 192.168.6.102
<h1> RS1 <h1>
[root@host ~]# curl 192.168.6.102
<h1> RS2 <h2>
[root@host ~]#