Tuesday, December 21, 2010

Doing some works on Load Balancer with Crossroads.

Well, it's finally about time to begins my senior project stuffs.
Let's say I've been doing busy with some jobs earlier, So I didn't have a chance to look at it much.
But It is nearly new year, everybody's going back their home after midterm examinations.
For me, It's time to move on and working on stuffs.
The less people, The more I can concentrate on this work. (I don't like to be surrounded by people much.)

Talk to much, let's see how I install crossroads on ubuntu. It's easy and work fine.

First download the crossroads package from their website.
$cd /
$wget http://crossroads.e-tunity.com/downloads/crossroads-stable.tar.gz
Untar it.
$tar -xzvf crossroads-stable.tar.gz
Then before starting our installation. Make sure that you've already installed the build-essential package.
$sudo apt-get install build-essential
 Let's begin!
$cd crossroads-2.68
$sudo make install
Wait for a moment. Then we done!
Now it's time for configuration.
Crossroads provides two ways of configuration. Using command-line, or using xml.
Let's see the first one. If we need to use command-line, then we use "xr" command for all configuration.
$xr --verbose --server tcp0:80 / #this will tell xr that we use this server as load balancer
-W 10.10.10.1:8001 / #and this will create our web interface on port 8001
-backend 10.10.10.2:80 / #this will create backend according to the ip address and port
-backend 10.10.10.3:80
This will make your server to listen to port 80 and to dispatch traffic to servers 10.10.10.2 and 10.10.10.3
A web interface for the balancer is started on port 8001

Instead of starting XR by hand, we may use xrcrl as preferable. But first, you've to create a configuration.
To do so, put the following in the file /etc/xrctl.xml
<?xml version="1.0" encoding="UTF-8"?>
     <configuration>
        <system>
          <uselogger>true</uselogger>
          <logdir>/tmp</logdir>
        </system>
        <service>
          <name>web</name>
        <server>
          <address>0:80</address>
          <type>tcp</type>
          <webinterface>10.10.10.1:8001</webinterface>
          <verbose>yes</verbose>
        </server>
        <backend>
          <address>10.10.10.2:80</address>
        </backend>
        <backend>
          <address>10.10.10.3:80</address>
        </backend>
        </service>
     </configuration>
Then type these following commands to start the xr
$xrctl start
Or to stop.
$xrctl stop 
That's all for today. Late night again. OMG!!

Credits : Crossroads

No comments:

Post a Comment