Load Balancing cluster is currently the most used cluster type, through the primary node load scheduler (Director), using a specific shunt algorithm, the access requests from the client to a number of server nodes to work together to alleviate the overall system load pressure, response to more requests; cluster load scheduling technology, It can be distributed based on IP, port, content, etc., where IP-based load scheduling is the most efficient. In the IP-based load balancing model, there are three modes of operation, such as address translation, IP tunneling and direct routing.
Three modes of operation, the NAT mode only needs a public IP address, thus becoming the most easy-to-use load-balancing mode, security is also better, many hardware load-balancing devices are used this way, compared to the DR model and Tun mode load capacity is more powerful, more extensive application, However, the security of the node is worse, because the two modes are the node directly responding to the client, exposing the IP, while the NAT mode node responds to the client to go to the director. The difference between Tun and Dr is that the load scheduler and nodes in Dr Mode are placed in the same network, while the nodes of Tun mode can be located in different regions to achieve disaster recovery.
One, load Balancing cluster operation mode
(1) Address translation, referred to as Nat mode, similar to the firewall of the private network structure, director as a gateway for all server nodes, that is, as the client access to the portal, but also the client's access to the node to the exit. The server node uses a private IP address and is located in the same physical network as the director, which is more secure than the other two methods.
(2) IP tunnel, referred to as Tun mode; with an open network structure, the Director acts as the Access portal for the client only, and each node responds directly to the client through its own Internet connection and no longer passes through the director. The server nodes are scattered in different locations in the Internet, with independent public IP addresses, communicating with the director through a dedicated IP tunnel.
(3) Direct routing, referred to as Dr Mode; The semi-open network structure is similar to the Yun model, but the nodes are not scattered everywhere, but are located in the same physical network as the director. The director connects to each node server through the local network and does not require a dedicated IP tunnel.
Two, load Balancing cluster basic architecture
Load balancing clusters, including three basic levels of components:
(1) The front end has only one load scheduler (load Balancer, or director) responsible for responding to and distributing access requests from clients according to an algorithm
(2) After driven by a large number of real servers (real server) constitute a server pool, providing real-world application services, the overall scalability of the cluster by adding, removing server nodes to complete, and these processes are transparent to the client
(3) To maintain service consistency, all nodes use shared storage devices
Three levels of component functions are explained:
(1) Load Scheduler
This is the only access to the entire cluster system, external use of all servers common VIP (virtual IP) address, also known as the cluster IP address, internal and server pool connection IP address is called dip, usually configure the main, standby two schedulers to implement hot backup, Ensure high availability by smoothing the replacement of the primary scheduler to the standby scheduler after failure.
(2) Server pool
The application services provided by the cluster, such as HTTP, FTP, are assumed by the server pool, where each node has a separate RIP (real IP, real IP) address, only the client requests distributed by the scheduler, and when a node is temporarily invalidated, the load scheduler's fault-tolerant mechanism isolates it. Wait for the error to exclude and then re-include the server pool.
(3) shared storage
Provides stable, consistent file access services for all nodes in the server, ensuring consistency across the cluster. In a Linux/unix environment, shared storage can use a NAS device, or a dedicated server that provides NFS (network file system) shared services.
Three, load Balancing cluster scheduling algorithm
We take LVs (Linux Virtual Server) as an example to study several common scheduling algorithms for load Balancing clusters
(1) Polling (Round Robin): The access requests are assigned in sequence to each node in the cluster (real server), equal to each server, regardless of the actual number of connections and system load of the server
(2) Weighted polling (Weighted Round Robin): Depending on the processing power of the real server, the received access requests are assigned in turn, and the scheduler can automatically query the load situation of each node and dynamically adjust its weights. This will ensure that the processing capacity of the server to assume more access traffic.
(3) Minimum connection (Least Connections): Allocated based on the number of connections established by the real server, prioritizing received access requests to nodes with the least number of connections. If all server nodes have similar performance, the load can be better balanced in this way.
(4) Weighted minimum connection (weidghted Least Connections): or the number of connections, meaning that in the case of the same number of connections, and in the server node performance difference is large, you can automatically adjust the weight for the real server, Nodes with higher weights will assume a larger percentage of active connection loads
Load Balancing cluster LB