High Availability ---- keepalived + lvs

What is availability?

HA (high availability) that is highly available; when is the single point of failure in a high-availability cluster to automatically shift resources and switching service, to ensure always-on service mechanism.

LVS

LVS: (linux virtual server) that is linux virtual server; mainly to achieve load balancing role.

LVS composition

LVS program consists of two parts, including ipvs and ipvsadm

  1. ipvs (ip virtual server): a piece of code work in kernel space, called ipvs, the code went into effect achieved scheduling.
  2. ipvsadm: another period of work in user space, called ipvsadm, is responsible for the preparation ipvs core framework of rules that define who is a cluster service, and who is the real back-end server (Real Server)

Load Balancing Compare

LVS:

  1. Strong anti-load capacity. Anti-load capacity, high performance, can reach 60% F5 hardware; memory and cpu resource consumption is relatively low
  2. 4 works in the network layer, the vrrp forwarding protocol (the distribution purposes only), the specific processing flow of the linux kernel, so no flow.
  3. Stability, reliability, itself has a perfect Redundancy; (eg: LVS + Keepalived)
  4. Broad range of applications, load balancing can be done for all applications;
  5. Does not support regular treatment, we can not do static and dynamic separation.
  6. It supports load balancing algorithms: rr (round robin), wrr (weighted round robin), lc (minimum connection), wlc (weighted least connections)
  7. Complex configuration, dependent on the network is relatively large, high stability.

Ngnix:

  1. Work on the seven layers of the network, you can do some diversion policy for http applications, such as for the domain name, the directory structure;
  2. Nginx dependent on the network is relatively small, it is theoretically possible to ping function of load can be carried out;
  3. Nginx relatively simple to install and configure, test more convenient;
  4. It can also take a high load pressure and stable, generally support more than 10,000 concurrent times;
  5. Health checks for the back-end server supports only be detected through the port does not support detected by url.
  6. Nginx asynchronous processing request can help reduce the load on the server node;
  7. Nginx can only support http, https and Email protocols, so that a lesser scope.
  8. It does not support the Session held directly, but through the ip_hash to resolve. On the Big request header support is not very good,
  9. Supports load balancing algorithms: Round-robin (round robin), Weight-round-robin (weighted round robin), Ip-hash (Ip hash)
  10. Nginx can do a Web server that is Cache function.

HAProxy:

  1. Agent supports two modes: TCP (four) and HTTP (seven), support for virtual hosts;
  2. Nginx can complement some shortcomings such as Session remains, Cookie guidance, etc.
  3. Support url detection of the back-end server detects the problem will be a good help.
  4. More load balancing strategies such as: Dynamic Weighted Round Robin (Dynamic Round Robin), weighted source address hash (Weighted Source Hash), weighted and weighted parameters URL hash hash (Weighted Parameter Hash) has been achieved
  5. Just from the efficiency in terms of HAProxy more than Nginx has better load balancing speed.
  6. HAProxy can load balance Mysql, the rear end of the DB nodes to detect and load balancing.
  7. Supports load balancing algorithms: Round-robin (round robin), Weight-round-robin (weighted round robin), source (original address remains), RI (request URL), rdp-cookie (based on cookie)
  8. That can not be done Web server Cache

keepalived

Guess you like

Origin www.cnblogs.com/du-z/p/11120825.html
Recommended