Reprinted: http://23live.cn/server/lvs-keepalived-haproxy-heartbeat/
I have been reading some highly available Server Load balancer solutions recently. Of course, hardware devices such as F5 cannot afford or access them. You can only look at these open-source solutions for free.
Currently, LVS and haproxy are both used to achieve load balancing. keepalived and heartbeat both improve high availability and avoid single point of failure. Why are they so different from each other?
After some Googles, I have understood the differences between the two:
LVS forwards data packets through vrrp and provides layer-4 Server Load balancer. It is characterized by high efficiency. As long as your machine's network card is resistant, it is not a problem.
Haproxy can provide layer-4 or layer-7 data forwarding services. The advantage of layer-7 is that it can load data according to the service status.
The two mentioned above only achieve load balancing, but they are obviously single point of failure. Therefore, hot backup is required using dual-host software to ensure high availability. Keepalived can be switched by detecting vrrp packets, so it is more suitable for use with LVS. Heartbeat is more suitable for combination with haproxy. In this way, there are many classic load balancing high availability solutions for these two applications.
I always wanted to learn these two solutions and learn the configurations of these four software, but I thought it would never be used? Or, new technologies may have emerged. I can use it myself. software like reverse proxy is enough, and squid is really hard to learn. I feel pretty good about nginx. It is widely recognized that it can be used as a reverse proxy to achieve load balancing and implement traffic separation through the GEO module to achieve global (different regions) load balancing, the simple configuration is definitely the first choice for individuals. You can use heartbeat to achieve high availability.
The next learning goal is to simplify the configuration of nginx GEO and heartbeat.