Setting Up ‘XR’ (Crossroads) Load Balancer for Web Servers on RHEL/CentOS

Crossroads is a service independent, open source load balance and fail-over utility for Linux and TCP based services. It can be used for HTTP, HTTPS, SSH, SMTP and DNS etc. It is also a...

Spread the love

Crossroads is a service independent, open source load balance and fail-over utility for Linux and TCP based services. It can be used for HTTP, HTTPS, SSH, SMTP and DNS etc. It is also a multi-threaded utility which consumes only one memory space which leads to increase the performance when balancing load.

Let’s have a look at how XR works. We can locate XR between network clients and a nest of servers which dispatches client requests to the servers balancing the load.

If a server is down, XR forwards next client request to the next server in line, so client feels no down time. Have a look at the below diagram to understand what kind of a situation we are going to handle with XR.

Install XR Crossroads Load Balancer

Install XR Crossroads Load Balancer

There are two web-servers, one gateway server which we install and setup XR to receive client requests and distribute them among the servers.

XR Crossroads Gateway Server :
Web Server 01 :
Web Server 02 :

In above scenario, my gateway server (i.e XR Crossroads) bears the IP address, webserver01 is and it listens through port 8888 and webserver02 is and it listens through port 5555.

Now all I need is to balance the load of all the requests that receives by the XR gateway from internet and distribute them among two web-servers balancing the load.

Step1: Install XR Crossroads Load Balancer on Gateway Server

1. Unfortunately, there isn’t any binary RPM packages available for crosscroads, the only way to install XR crossroads from source tarball.

To compile XR, you must have C++ compiler and Gnu make utilities installed on the system in order to continue installation error free.

# yum install gcc gcc-c++ make

Next, download the source tarball by going to their official site (, and grab the archived package (i.e. crossroads-stable.tar.gz).

Alternatively, you may use following wget utility to download the package and extract it in any location (eg: /usr/src/), go to unpacked directory and issue “make install” command.

# wget
# tar -xvf crossroads-stable.tar.gz
# cd crossroads-2.74/
# make install
Install XR Crossroads Load Balancer

Install XR Crossroads Load Balancer

After installation finishes, the binary files are created under /usr/sbin/ and XR configuration within /etc namely “xrctl.xml”.

2. As the last prerequisite, you need two web-servers. For ease of use, I have created two python SimpleHTTPServer instances in one server.

To see how to setup a python SimpleHTTPServer, read our article at Create Two Web Servers Easily Using SimpleHTTPServer.

As I said, we’re using two web-servers, and they are webserver01 running on through port 8888 and webserver02 running on through port 5555.

XR WebServer 01

XR WebServer 01

XR WebServer 02

XR WebServer 02

Step 2: Configure XR Crossroads Load Balancer

3. All requisites are in place. Now what we have to do is configure the xrctl.xml file to distribute the load among the web-servers which receives by the XR server from the internet.

Now open xrctl.xml file with vi/vim editor.

# vim /etc/xrctl.xml

and make the changes as suggested below.

<?xml version=<94>1.0<94> encoding=<94>UTF-8<94>?>
Configure XR Crossroads Load Balancer

Configure XR Crossroads Load Balancer

Here, you can see a very basic XR configuration done within xrctl.xml. I have defined what the XR server is, what are the back end servers and their ports and web interface port for the XR.

4. Now you need to start the XR daemon by issuing below commands.

# xrctl start
# xrctl status
Start XR Crossroads

Start XR Crossroads

5. Okay great. Now it’s time to check whether the configs are working fine. Open two web browsers and enter the IP address of the XR server with port and see the output.

Verify Web Server Load Balancing

Verify Web Server Load Balancing

Fantastic. It works fine. now it’s time to play with XR.

6. Now it’s time to login into XR Crossroads dashboard and see the port we’ve configured for web-interface. Enter your XR server’s IP address with the port number for web-interface you have configured in xrctl.xml.
XR Crossroads Dashboard

XR Crossroads Dashboard

This is what it looks like. It’s easy to understand, user-friendly and easy to use. It shows how many connections each back end server received in the top right corner along with the additional details regarding the requests receiving. Even you can set the load weight each server you need to bear, maximum number of connections and load average etc..

The best part is, you actually can do this even without configuring xrctl.xml. Only thing you have to do is issue the command with following syntax and it will do the job done.

# xr --verbose --server tcp: --backend --backend

Explanation of above syntax in detail:

  1. –verbose will show what happens when the command has executed.
  2. –server defines the XR server you have installed the package in.
  3. –backend defines the webservers you need to balance the traffic to.
  4. Tcp defines it uses tcp services.

For more details, about documentations and configuration of CROSSROADS, please visit their official site at:

XR Corssroads enables many ways to enhance your server performance, protect downtime’s and make your admin tasks easier and handier. Hope you enjoyed the guide and feel free to comment below for the suggestions and clarifications. Keep in touch with Tecmint for handy How To’s.

Read Also: Installing Pound Load Balancer to Control Web Server Load

Facebook Comments

More Stuff

How to Install Varnish Cache 5.2 for Nginx on CentOS 7 Varnish Cache (also referred to as Varnish) is an open source, high-performance HTTP accelerator designed for speeding up web servers. In our last art...
How to Install cPanel and WHM in CentOS 7 cPanel is a well known, most reliable and intuitive commercial control panel for web hosting services. It is rich in feature and can be used via a pow...
Screenlets: An Amazing Tool to Add Desktop Gadgets/Widgets in Linu... Screenlets is an application software released under GNU GPL. The same name screenlets refers to the engine as well as widget that runs on it. It was ...
For the Pixel 3, Google is betting on a chip to bring Android secu... Rick Osterloh, Google's senior vice president of hardware, talks about the Titan M security chip at the Pixel 3 event last week. Sarah Tew/CNETGoo...
Spread the love

Posted by News Monkey