Using the cluster technology of NAT mode, LVS load dispatcher is the gateway server for all nodes to access the Internet, and its 200.0.0.1 is also the VIP address of the whole cluster.

Use polling (rr) scheduling algorithm.

Web 1 and web2 first build web services, prepare different web files for client access, in order to determine that client access LVS server 200.0.0.1, can access two wbe servers.

After the client test is successful, web1 and web2 can mount the shared directory provided by the NFS server to provide the same web page file for the client.I. Prepare:1. First debug the network to interoperability2. Prepare system mirroring and related software packages to build httpd services and install related tools. For convenience, the installation package in the system image is directly used to build the httpd service.3. Configuring the firewall policy to release traffic (figure is convenient, I stopped the firewall directly here)2. Configure the load dispatcher:Turn on routing forwarding:

ipvsadm is a LVS cluster management tool used in load dispatcher. It adds and deletes server nodes by calling ip_vs module, and checks the running status of the cluster (manual installation is required).

Of course, in the actual production environment, the content of the web page is the same. In order to distinguish whether the experiment is successful or not, I wrote two test files with different contents.Test whether LVS is working:Refresh the page:3. NFS Shared Storage Service:Building NFS sharing enables two web servers to mount directories shared by the same NFS server to provide the same web page files.Install nfs-utils, rpcbind packages:

These two software packages I use rpm-qa to check on Centos 7 are there, specifically here I am not very clear whether the system is installed when the self-contained, so when doing, still knock this order, in case, if the big man knows, but also bother to inform younger brother. (Thank you)Set the shared directory:

Test verification:.We see that the test files written on NFS have been accessed successfully, but they will not change no matter how they are refreshed, which means that LVS load balancing is also successful.

When the LVS server is restarted, the LVS rules will be lost, so backup is used. It should be noted that the host name of backup and recovery must be the same, and the priority of network card should be paid attention to. Otherwise, after recovery, VIP (cluster virtual IP) will be found to be another IP address of LVS server.