warning: DOMNode::appendChild() [domnode.appendchild]: Document Fragment is empty in /home/wowtutor/public_html/sites/all/modules/adsense_injector/adsense_injector.module on line 265.

How To Install And Configure Litespeed Load Balancer

What is LiteSpeed Load Balancer

LiteSpeed Load Balancer (LSLB) is a high-performance, content-aware, session-aware HTTP application load balancer. It can forward requests based on request content as well as session stickiness preference. LiteSpeed Load Balancer can help scale your application beyond one server deployment, as well as improve the reliability of your service in case of hardware failures.

Example: we will build 1 load balancer with 2 webserver behind load balancer.


Prepare Servers to start

FreeBSD Server With Litespeed Load Balancer (10.10.1.1)
Centos Webserver 1 with Apache running (10.10.1.2)
Centos Webserver 2 with Apache running (10.10.1.3)
We assume you already have Linux/FreeBSD server install and running.

Install Litespeed Load Balancer in FreeBSD (10.10.1.1)

Login As Root

Note : Please disable HTTP services port 80, because we will need this to running LiteSpeed Load Balancer on port 80.

Download Litespeed Load Balancer From This URL
http://www.litespeedtech.com/packages/lslb/lslb-1.1-i386-freebsd6.tar.gz

[code]$cd /root
$wget http://www.litespeedtech.com/packages/lslb/lslb-1.1-i386-freebsd6.tar.gz
$tar -zxvf lslb-1.1-i386-freebsd6.tar.gz
$cd lslb-1.1[/code]

Get Free 15-day Trial License from this url
http://www.litespeedtech.com/trial/license/
Check your email because the trial key will attached in your email.
Download trial.key and upload it into /root/lslb-1.1

Install Litespeed Load Balancer

[code]$./install.sh
Do you agree with above license? Y
Destination [/opt/lslb]: /usr/local/lslb
[OK] Your trial license key will expire in xx days!

Please specify the user name of the administrator.
This is the user name required to log into the web administration console.

User name [admin]: (press ENTER)
Password: (your admin password)
Retype password: (your admin password)
User [nobody]: (press ENTER)
Group [nobody]: (press ENTER)
HTTP port [8090]: 80
Admin HTTP port [7090]:(press ENTER)
Enable chroot [y/N]: (press ENTER)
Would you like to have LiteSpeed Load Balancer started automatically when the machine restarts [Y/n]? (Press Enter)
Would you like to start it right now [Y/n]? (Press Enter)

[OK] Your trial license key will expire in xx days!
[OK] lslbd: pid=21922.
[/code]
LiteSpeed Load Balancer started successfully! Have fun!

Install 2 Webserver in Centos 4.x (10.10.1.2 and 10.10.1.3)

Webserver 1 (10.10.1.2)

Login As Root
[code]web1$yum -y install httpd
web1$cd /var/www/html
web1$vi index.html
Welcome to Webserver 1

## save this file[/code]

Webserver 2 (10.10.1.3)


Login As Root
[code]web2$yum -y install httpd
$vi index.html
web1$cd /var/www/html
web1$vi index.html
Welcome to Webserver 2

## save this file[/code]

Note: make sure we can access http://10.10.1.2 and http://10.10.1.3
with a default Welcome to Webserver 1 and 2 messages.

Configure Litespeed Load Balancer

Login into Litespeed Web Based
http://10.10.1.1:7090

Username : admin
Password : (your admin password)

Configure Virtual Hosts 

Click Configuration >> Virtual Hosts 

You will see a Virtual Hosts Page
Click Add

Input your Virtual Host Name : Ex. wowtutorial.org
Default Cluster
: clusterHTTP
Configure File : $SERVER_ROOT/conf/wowtutorial.org.xml
Click SAVE



You will see a Input error detected. Please resolve the error(s)
Click link "CLICK TO CREATE"
Click SAVE

Click SAVE again to finished 

You will see your new Virtual Hosts already added in Virtual Host List like picture below. 

Next We need to Apply Changes, just click the link Apply Changes 

Configure Load Balancer Clusters 

Click on Clusters(5) tabular
Click ClusteHTTP from Cluster List

You will see a ClusterHTTP page like picture below
Click on Worker Group tabular
Click on nodeHTTP

You will see a nodeHTTP page
Click Edit to continue

Next we need to input Node Address List for our 2 web servers like below, please change with your node ip address.

(wowtutorial1) = node name
10.10.1.1 = load balancer ip address
10.10.1.2 and 10.10.1.3 = 2 web servers

so it's mean if someone hit wowtutorial.org it will automatically hit 10.10.1.1 and litespeed load balancer will automatically detect least load, we can change it to round robin,least load or least session .
We leave it default.

Click SAVE 

Configure Load Balancer Listener

Click on Listeners(1) tabular
Click View/Edit

You need to click Add to add our virtual host wowtutorial.org into Listener
Click Add

 

Choose your Virtual Host : Ex : wowtutorial.org
Input your Domains : wowtutorial.org, www.wowtutorial.org 

Click SAVE 

You will see your domain wowtutorial.org already map in Listener List 

Restart Litespeed Load Balancer 

Click Apply Changes like picture below

Next, Click Apply Changes / Graceful Restart like picture below 

We are done!!

Testing Out Litespeed Load Balancer 

First We need to make sure wowtutorial.org is pointing to 10.10.1.1 in DNS server. ( i assume we have done this before )

Next Try to access http://www.wowtutorial.org from browser and see which webserver is listen first
Example if Web1 (10.10.1.2) is listen first like picture below

We need to login into the webserver 1 using ssh and stop http services
[code]$service httpd stop[/code]

after that  try to access http://www.wowtutorial.org again. if you see like picture below it's mean load balancer is working properly.

This is also mean load balancer 10.10.1.1 automatically redirect it to 10.10.1.3 

You can also try to shutdown the http services in webserver2 and start http services in webserver1
After that try to access http://www.wowtutorial.org . it will automatically redirect it to webserver 1.

IMPORTANT : if you see any 503 messages in your browser it's mean you need to increased Initial Request Timeout (secs) in clusterHTTP worker, try to increase it to 90 - 120 secs

Facebook Fans