Http://www.formilux.org/archives/haproxy/1003/3259.html
Anyway, I would like to say that I was surprised at the number of people who used the heartbeat to get redundant haproxy settings. It is not the best tool for * this * work, it is designed to build a cluster, which differs greatly from having two redundant stateless network devices. Network-oriented tools, such as keepalived or Ucarp, are the best tools for this task.
The difference between the two families is simple:
Cluster-oriented products such as heartbeats will ensure that shared resources exist at most in the * one location. This is important for sharing file systems, disks, and so on. It is designed to run services on one node during switchover, and on the other node. In this way, shared resources may never be accessed concurrently. It's a very difficult task, and it's doing well.
a network-oriented product, such as keepalived, will ensure that the shared IP address appears at least in a single place. Please note that I am not talking about a service or resource, it just plays the IP address. It does not attempt to reduce or upgrade any services, it only considers a certain number of criteria to determine which node is best suited to serve. However, the service must already be on two nodes. Therefore, it is ideal for redundant routers, firewalls, and proxies, but not for disk arrays or file systems.
In the case of a dirty failure (such as splitting the brain), the difference is very obvious. Cluster-based products are likely to end up without a service node to ensure that shared resources are not corrupted by concurrent access. A network-oriented product may end up on two nodes, resulting in the service being available to both. (Phil Note: Since it is stateless, why not allow the client to load-balance, directly provide two IP. But sometimes it is to provide one that simplifies the client logic.) That's why you don't want to use UCARP or keepalived to provide a file system from a shared array.
The nature of control and change also affects the switching time and the ability to test services offline. For example, with keepalived, if a dirty fault occurs, the IP can be switched from one node to another in a short period of time, or a zero delay in the case of a volunteer switchover, as there is no need to start
Anyway, I ' d like-say that I ' m amazed by the number of people who use heartbeat to get a redundant haproxy setup. It isn't the best tool for this job, it's designed to build clusters, which are a lot different from having a Redundan T stateless network equipments. Network oriented tools such as keepalived or Ucarp is the best suited for that task.
The difference between those and families are simple:
a cluster-oriented product such as heartbeat would ensure that a shared resource would be present at *at most* one plac E. Very important for shared filesystems, disks, etc ... It is the designed to take a service down on one node and up on another one during a switchover. That is the shared resource may never is concurrently accessed.
This was a very hard task to accomplish and it does it well. A network-oriented product such as keepalived would ensure that a shared IP address would be present at *at least* one place . Please note that I am not talking on a service or resource anymore, it just plays with IP addresses. It'll just consider a certain number of the criteria to decide which node is the Most suited to offer the service. But the service must already is up on both nodes. As such, it is very well suited for redundant routers, firewalls and proxies, but not at all for disk arrays nor Filesyste
Ms.
The difference is very visible in case of a dirty failure such as a split brain. A cluster-based product very well end up with none of the nodes offering the service, to ensure that the shared resour Ce is never corrupted by concurrent accesses. A network-oriented Product may end up with the IP present on both nodes, resulting in the service being available on both of them. This is the reason so you don ' t want to serve file-systems from GKFX arrays with Ucarp or keepalived.
The nature of the controls and changes also has a impact on the switch time and the ability to test the service offline. For instance, with keepalived, you can switch the IP from one node to another one in just one second in case of a dirty FA Ilure, or in zero delay in case of volunteer switch, because there is no need to start/stop anything. That also means so even if you ' re experiencing flapping, it's not a problem because even if the IP constantly moves, it Moves between places where the service is offered. And since the service is permanently available on the backup nodes, you can test your configs there without impacting the Master node.
So-in-short, I-would not-like-to has my router/firewall/load balancer running on heartbeat, as-I would not-like T O has my fileserver/disk storage/database run on keepalived.
With keepalived, your setup above is trivial. Just Configure-interfaces with their GKFX IP addresses, enumerate the interfaces you want to track, declare scripts To check the services if you want and that's all. If any interface fails or if Haproxy dies, the IP immediately switches to the other node. If both nodes lose the same interface (eg:shared switch failure), you still has part of the service running on one of th E nodes on the other interface.
Hoping this helps understanding the different types of architectures one might encounter,
Willy