The Linux virtual server (LVS) system is composed of the Load balancer, server cluster, and file servers, in Linux, Server Load balancer combines a group of servers into a service cluster, and the front end of the actual Server is a Load balancer, after the user requests are scheduled to the actual server for execution, the results are returned to the user. The end user can see only one server. Because the Load Scheduling Technology is implemented in the Linux kernel, we call it Linux virtual server. As mentioned above, the current network service requires the system to provide services with high reliability and availability, that is, the system data cannot be lost when the system is damaged or faulty, in addition, to restore the normal operation of the system in the shortest time, we will discuss the basic principles of LVS (see figure 1) and some service security performance.
Appendix 1
The external network connecting the user is Internet/Intranet, and the server group is connected by Intranet (usually high-speed LAN or geographically distributed WAN. The server Load balancer has two IP addresses: an external gateway and an internal gateway. When a user from the external network sends a request, the Server Load balancer is responsible for scheduling the tasks required by the user to the server in the server cluster for execution. The specific scheduling policy currently has four scheduling algorithms: round-robin scheduling, Weighted Round-round scheduling, and least-connectionscheduing) and weighted least-connectionscheduing ). LVS uses the IP layer Load Balancing Technology and ipvs software to achieve three IP load balancing technologies. In the Linux operating system, the TCP and UDP requests at the IP layer are evenly transferred to different servers. When a user's request arrives, the scheduler selects a server from the server group to forward the request and execute it, and records the scheduling. All of this is done in the core space of the operating system, and the scheduling overhead is very small, so that the number of nodes in the server cluster can reach 25 or up to 100. The file storage system is implemented based on a fault-tolerant distributed file system, such as coda.
The high reliability of LVS network services is mainly reflected in:
1. the load scheduler runs a monitoring process, Mon, which monitors the status of service processes and various server nodes in the server cluster. By configuring the fping listener, each server node is detected at a certain time. You can configure a service listener to probe different service processes on all nodes. For example, HTTP Monitor is used to probe HTTP Services. Once an error occurs, the monitoring process sends an alert to the scheduler to delete the node from the scheduling list, so that the scheduler can automatically block the failure of the server node. When the server node recovers, the scheduler adds the node to the scheduling list, so that the system is always correctly reset and the number of nodes in the server cluster is variable, because the node failure is blocked, the system administrator can add or delete one or more nodes at any time without interfering with the services provided to users. This means that when the LVS system is overloaded, we can increase the number of nodes in the service cluster to meet user requests. When an actual server in the server group fails, it can be deleted but does not affect the services of users, so as to achieve efficient and reliable services.
2. On the basis of the first point, the scheduler has now become a single failure point, and the failure of the scheduler will paralyze the entire system. To prevent the failure of the master scheduler, you need to create a backup slave scheduler. The two heartbeat processes run on the master and slave schedulers respectively, and report their health status to each other on a regular basis. Once the scheduler detects that the master scheduler is invalid, the fake program is activated to take over the virtual IP address to provide Load Balancing scheduling. When the scheduler detects that the master scheduler recovers, the virtual IP address is released, the master scheduler recovers and provides the load scheduling service. Although the failure and takeover of the master scheduler will lead to the loss of scheduling information, You Need To resend the request. However, this greatly improves the security and reliability of the system, so that once the master scheduler fails, the system can restore services within a short period of time.