Introduction
In this article, we will see together 3 famous Open Source solutions used in most common Web Architectures : HAProxy, Corosync and Pacemaker.
First, let’s see together the different kind of clusters and then, we will have an overview of the 3 solutions mentioned above.
Clustering Architectures
High Performance Clusters
The first type of cluster is the High Performance Cluster.
Basically it consists of different computers working together to host one or more tasks that require lots of computing resources. All computers are colled nodes.
You can find more information on my previous article : Click Here.
High Availability Clusters
A HA Cluster is used in environments that have heavy computing needs. It’s a group of hosts that act like a single system and provide continuous uptime.
To build a high availability cluster, you will need more than just a few servers tied together.
Typically, the following components are used :
- Shared storage (GlusterFS, Lustre)
- Different networks
- Bonded network devices (Network bonding is a process of combing or joining two or more network interfaces together into a single interface)
- Multipathing (multiple physical routes between a server and the storage device)
- Fencing (process of isolating a node of a computer cluster or protecting shared resources when a node appears to be malfunctioning)
Load Balancing Clusters
A Load Balancing Cluster is used in heavy-demand environments like popular websites.
The goal is to redistribute tasks and take care of the load distribution.
In this example, the Proxy redistributes tasks on one of the three Web Servers. It can be configured with HAProxy.
HAProxy
HAProxy is a free, very fast and reliable solution offering high availability, load balancing and proxying for TCP and HTTP-based applications. It is particularly suited for very high traffic web sites.
You can for example redirect incoming traffic on a different host / port with round robin. You will have to configure two types of nodes with HAProxy :
- Frontend : the node by which HAProxy listens for connections.
- Backend : nodes by which HAProxy can forward requests.
A third node type, the stats node, can be used to monitor the load balancer and the other two nodes.
HAProxy has the following features:
- Layer 4 (TCP) and Layer 7 (HTTP) load balancing
- URL rewriting
- Rate limiting
- SSL/TLS termination
- Gzip compression
- Proxy Protocol support
- Health checking
- Connection and HTTP message logging
- HTTP/2
- Multithreading
- Hitless Reloads
- gRPC Support
- Lua and SPOE Support
- API Support
- Layer 4 Retries
- Simplified circuit breaking
Corosync and Pacemaker
Corosync is an open source Cluster Engine. It is actually a Communication System that enables two or more Linux Cluster nodes to transfer information between them. Corosync is constantly listening on configured port number where Linux Cluster nodes are sending information. Corosync Communication System enables all of the nodes to know the exact state of each other at all time. In case one of the Linux Cluster nodes fails this information will be immediately transferred to other still exsisting Linux Cluster nodes.
Pacemaker is an open source high availability Resource Manager. As the name says, Pacemaker manages resources. It will basically starts and stops services and contains logic for ensuring both that they are running.
Here are the features you will have with both solutions :
- Detection and recovery of machine and application-level failures
- Supports practically any redundancy configuration
- Supports both quorate and resource-driven clusters
- Configurable strategies for dealing with quorum loss (when multiple machines fail)
- Supports application startup/shutdown ordering, regardless of which machine(s) the applications are on
- Supports applications that must/must-not run on the same machine
- Supports applications which need to be active on multiple machines
- Supports applications with multiple modes (eg. master/slave)
- Provably correct response to any failure or cluster state.
- The cluster’s response to any stimuli can be tested offline before the condition exists
Sources
haproxy.org
wikipedia.org
geekpeek.net
clusterlabs.org