环境配置:
RHCE | 客户机 | 192.168.100.146 |
node1 | lvs | 192.168.100.145 |
node2 | RS | 192.168.100.147 |
node3 | RS | 192.168.100.148 |
配置ipvsadm httpd:
[root@node1 ~]# yum install ipvsadm.x86_64
[root@node2 ~]# yum install http -y
[root@node2 ~]# systemctl start httpd
[root@node3 ~]# yum install http -y
[root@node3 ~]# systemctl start httpd
配置LVS虚拟IP(VIP)
[root@node1 ~]# ifconfig ens33:200 192.168.100.200 netmask 255.255.255.0 up
将内容写入/var/www/html 测试httpd
[root@node3 ~]# echo "web test page,ip is `hostname -I`" > /var/www/html/index.html
[root@node3 ~]# systemctl start httpd
[root@node3 ~]# curl 192.168.100.148
web test page,ip is 192.168.100.148[root@node2 ~]# echo "web test page,ip is `hostname -I`" > /var/www/html/index.html
[root@node2 ~]# systemctl st