A. Experimental environment
Playing three servers, one as director, both as a real server, director
II. Installation
Ipvsadm installed on director
yum -y install ipvsadm
III. Configuring a network card on the director
Open Virtual Machine -> Settings -> Point Network Adapter -> Add -> Point Network Adapter -> Done (a NAT mode, a bridge mode)
and ifconfig look, there will be two network cards (a ens33, a ens77) should typically are ens77
In the static network configuration (on the director)
vim / etc / sysconfig / network- scripts / ifcfg-ens33
save and exit
Restart Network
service network restart
ifconfig view, this time you can see the card
IV. Are installed nginx service on two real server **
Install nginx step
1.wget http://nginx.org/download/nginx-1.16.0.tar.gz
2. unzip
tar -zxvf nginx-1.16.0.tar.gz
3. Install zlib, openssl, pcre and gcc
yum install openssl openssl-devel zlib zlib-devel pcre pcre-devel
yum -y install gcc gcc-c++
4.cd nginx-1.16.0
5. compile and install
./configure && make && make install
6.cd /usr/local/nginx/sbin
7. Detection
./nginx -t
appeared successful, said correct
8../nginx
9. Turn off the firewall
10. Enter the IP address in the browser
11. The modified distinguished server index.html
在 RS1 上执行
vim /usr/local/nginx/html/index.html (add your own ip in the body at)
Performed on the RS2
vim /usr/local/nginx/html/index.html (add your own ip in the body at)
V. configure
vim /usr/local/sbin/lvs_nat.sh
After saving, run the script directly on the Director to complete lvs / nat configuration
/ bin / bash /usr/local/sbin/lvs_nat.sh
6. Check ipvsadm set of rules
ipvsadm -ln
7. turn off the firewall
systemctl STOP firewalld.service
setenforce 0
VIII. Test results ** LVS
By web content on the browser test two machines 192.168.253.140
ctrl + F5 to force a refresh browser