Linux: The Simplest Load Balancing Cluster with Failover

Linux: The Simplest High Availability Cluster with Synchronous Replication and Failover

Evidian SafeKit brings load balancing and failover to Linux. This article explains how to implement quickly a Linux cluster without network load balancers or dedicated proxy servers. SafeKit is installed directly on the Linux servers. The high availabity module farm.safe and a free trial are offered in the installation instructions section.

This clustering solution is recognized as the simplest to implement by our customers and partners. It is also a complete solution that solves hardware failures (20% of problems) including the complete failure of a computer room, software failures (40% of problems) including smooth upgrade server by server and human errors (40% of problems) thanks to its simplicity.

How the Evidian SafeKit software simply implements Linux load balancing and failover without network load balancers or dedicated proxy servers

How the Evidian SafeKit farm cluster implements Linux load balancing and failover?

On the previous figure, Linux services are running of the 3 servers. Users are connected to a virtual IP address which is configured locally on each server. The input traffic for the virtual IP address is received by all the servers and split among them by a filter inside each server's kernel.

The network load balancing algorithm inside the filter is based on the identity of the client packets (client IP address, client TCP port). Depending on the identity of the client packet input, only one filter in a server accepts the packet; the other filters in other servers reject it.

Once a packet is accepted by the filter on a server, only the CPU and memory of this server are used by Linux services that responds to the request of the client. The output messages are sent directly from the Linux server to the client.

If a server fails, the SafeKit membership protocol reconfigures the filters in the network load balancing cluster to re-balance the traffic on the remaining available servers.

Note that SafeKit works in VMware environments without the Microsoft NLB problems of unicast and muticast modes.  And note also that SafeKit network load balancing is working not only on Windows (including Windows editions for PCs) but also on Linux.

FAQ on Evidian SafeKit

Best use cases [+]

Customers [+]

Application high availability modules [+]

SafeKit Webinar [+]

Pricing - Free trial [+]

Comparison with other solutions [+]

Demonstration of a farm cluster [+]

What are the advantages of the farm cluster [+]

What is the recovery time (RTO) in a farm cluster [+]

Installation of SafeKit for Linux load balancing and failover

Package installation on Linux

On both Linux servers

Configuration instructions

The configuration is presented with the web console connected to 2 Windows servers but it is the same thing with 2 Linux servers.

Important: all the configuration must be done from a single browser.

Launch the web console in a browser by connecting to http://localhost:9010 (next image)

Start the SafeKit web console for configuring Linux

Enter IP address of the first node and click on Confirm (next image)

SafeKit web console - first Linux node in the cluster

Click on New node and enter IP address of the second node (next image)

SafeKit web console - second Linux node in the cluster

Click on the red floppy disk to save the configuration (previous image)

In the Configuration tab, click on farm.safe then enter farm as the module name and Confirm (next images with farm instead of xxx)

SafeKit web console - start configuration of Linux SafeKit web console - enter Linux module name

Click on Validate (next image)

SafeKit web console - enter Linux module nodes

Set the virtual IP address of the cluster, the TCP port of the service to load balance and the criterion on source IP address or source TCP port (next image).

A virtual IP address is a new unused IP address in the same IP network as the IP addresses of the two nodes. The load balancing will be made on the virtual IP address/TCP port according the criterion. This article explains difference between source IP address and source TCP port.

SafeKit web console - enter Linux parameters

For information:

Click on Validate (previous image)

SafeKit web console - stop the Linux module before configuration

Click on Configure (previous image)

SafeKit web console - check the success green messages of the Linux configuration

Check the success green message on both servers and click on Next (previous image)

SafeKit web console - start the Linux cluster on both nodes

Start the cluster on both nodes (previous image). Check that the status becomes UP (green) - UP (green) (next image).

SafeKit web console - Linux cluster started

The cluster is operational with Linux services running on both UP nodes (previous image).

Be careful, components which are clients of the Linux services must be configured with the virtual IP address. The configuration can be made with a DNS name (if a DNS name has been created and associated with the virtual IP address).

Tests

Check with Linux command lines that the Linux services are started on both UP nodes. Put Linux services with Boot Startup Type = Manual (SafeKit controls start of Linux services).

Stop one UP node by scrolling down the menu of the node and by clicking on Stop. Check that the load balancing is reconfigured with only the other node taking all TCP connections. And check that the Linux services are stopped on the STOP node with Linux command lines.

To understand what happens in the cluster, check the SafeKit logs of node 1 and node 2.

To see the module log of node 1 (next image):

SafeKit web console - Module Log of the Linux node 1

To see the application log of node 1 (next image):

SafeKit web console - Application Log of Linux node 1

To see the logs of node 2 (previous image), click on W12R2server75/UP (it will become blue) on the left side and repeat the same operations.

Advanced configuration

In Advanced Configuration tab, you can edit internal files of the module: bin/start_both and bin/stop_both and conf/userconfig.xml (next image on the left side). If you make change in the internal files here, you must apply the new configuration by a right click on the blue icon/xxx on the left side (next image): the interface will allow you to redeploy the modified files on both servers.

Configure boot start (next image on the right side) configures the automatic boot of the module when the server boots. Do this configuration on both nodes once the Linux load balancing and failover solution is correctly running.

SafeKit web console - automatic boot of the Linux module

Support

For getting support on the call desk of https://support.evidian.com, get 2 Snaphots (2 .zip files), one for each server and upload them in the call desk tool (next image).

SafeKit web console - Linux snaphots for support

Internal files of the Windows farm.safe module

userconfig.xml

<!DOCTYPE safe>
<safe>
<service mode="farm" maxloop="3" loop_interval="24">
  <!-- Farm topology configuration for the membership protocol -->
  <!-- Names or IP addresses on the default network are set during initialization in the console -->
  <farm>
    <lan name="default" />
  </farm>
  <!-- Virtual IP Configuration -->
  <!-- Replace
     * VIRTUAL_IP_ADDR_TO_BE_DEFINED by the IP address of your virtual server 
  -->
  <vip>
    <interface_list>
      <interface check="on" arpreroute="on">
        <virtual_interface type="vmac_directed">
          <virtual_addr addr="VIRTUAL_IP_ADDR_TO_BE_DEFINED" where="alias"/>
        </virtual_interface>
      </interface>
    </interface_list>
    <loadbalancing_list>
      <group name="Windows_Appli">
        <!-- Set load-balancing rule on the TCP port of the service to load balance -->
        <rule port="TCP_PORT_TO_BE_DEFINED" proto="tcp" filter="on_addr"/>
      </group>
    </loadbalancing_list>
  </vip>
  <!-- TCP Checker Configuration -->
  <!-- Replace
     * VIRTUAL_IP_ADDR_TO_BE_DEFINED by the IP address of your virtual server 
     * TCP_PORT_TO_BE_DEFINED by the TCP port of the service to check
  -->
  <check>
    <tcp ident="Check_Appli" when="both">
      <to
         addr="VIRTUAL_IP_ADDR_TO_BE_DEFINED"
         port="TCP_PORT_TO_BE_DEFINED"
         interval="10"
         timeout="5"
       />
    </tcp>
  </check>
  <!-- User scripts activation -->
  <user nicestoptimeout="300" forcestoptimeout="300" logging="userlog" />
</service>
</safe>

start_both

#!/bin/sh
# Script called on the primary server for starting application

# For logging into SafeKit log use:
# $SAFE/safekit printi | printe "message" 

# stdout goes into Application log
echo "Running start_both $*" 

res=0

# Fill with your application start call

if [ $res -ne 0 ] ; then
  $SAFE/safekit printe "start_both failed"

  # uncomment to stop SafeKit when critical
  # $SAFE/safekit stop -i "start_both"
fi

stop_both

#!/bin/sh
# Script called on the primary server for stopping application

# For logging into SafeKit log use:
# $SAFE/safekit printi | printe "message" 

#----------------------------------------------------------
#
# 2 stop modes:
#
# - graceful stop
#   call standard application stop
#
# - force stop ($1=force)
#   kill application's processes
#
#----------------------------------------------------------

# stdout goes into Application log
echo "Running stop_both $*" 

res=0

# default: no action on forcestop
[ "$1" = "force" ] && exit 0

# Fill with your application stop call

[ $res -ne 0 ] && $SAFE/safekit printe "stop_both failed"
contact
CONTACT
Demonstration

Evidian SafeKit Pricing





White Papers

NEWS

To receive Evidian news, please fill the following form.