centos 7 installation ipvsadm

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
centos 7 installation 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)
centos 7 installation ipvsadm
centos 7 installation ipvsadm
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
centos 7 installation ipvsadm
save and exit

Restart Network

service network restart

ifconfig view, this time you can see the card
centos 7 installation ipvsadm

IV. Are installed nginx service on two real server **

Install nginx step

1.wget http://nginx.org/download/nginx-1.16.0.tar.gz
centos 7 installation ipvsadm
2. unzip

tar -zxvf nginx-1.16.0.tar.gz
centos 7 installation ipvsadm

3. Install zlib, openssl, pcre and gcc

yum install openssl openssl-devel zlib zlib-devel pcre pcre-devel
centos 7 installation ipvsadm
yum -y install gcc gcc-c++
centos 7 installation ipvsadm
4.cd nginx-1.16.0

5. compile and install

./configure && make && make install
centos 7 installation ipvsadm

6.cd /usr/local/nginx/sbin

7. Detection

./nginx -t
centos 7 installation ipvsadm
appeared successful, said correct

8../nginx

9. Turn off the firewall

10. Enter the IP address in the browser
centos 7 installation ipvsadm

11. The modified distinguished server index.html

在 RS1 上执行

vim /usr/local/nginx/html/index.html (add your own ip in the body at)
centos 7 installation ipvsadm

Performed on the RS2
vim /usr/local/nginx/html/index.html (add your own ip in the body at)
centos 7 installation ipvsadm

V. configure
vim /usr/local/sbin/lvs_nat.sh
centos 7 installation ipvsadm
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

Guess you like

Origin blog.51cto.com/14259161/2423193
Recommended