UnixServerAdmin

Server Administration & Management

How to install and configure LVS to allow Load Balancing between Clusters/Nodes

The Linux Virtual Server Project (LVS) allows load balancing of networked services such as web and mail servers using Layer 4 Switching. It is extremely fast and allows such services to be scaled to service 10s or 100s of thousands of simultaneous connections. Now configure ipvsadm in both node

node-1 :- 192.168.3.201 :- node-1.unixserveradmin.com
node-2 :- 192.168.3.202 :- node-2.unixserveradmin.com

Virtual IP (VIP) :- 192.168.3.135

on node-1

# yum install ipvsadm

# ipvsadm-save

# ipvsadm-restore

# ipvsadm -C (Flush)

# ipvsadm-save > ipvsadm_rules.txt

# ipvsadm-restore < ipvsadm_rules.txt

# ipvsadm -A -t 192.168.3.135:80 (# ipvsadm -A -t 192.168.3.135:80 -s rr)

# ipvsadm -a -t 192.168.3.135:80 -r 192.168.3.201:80 -m

# ipvsadm -a -t 192.168.3.135:80 -r 192.168.3.202:80 -m

# /etc/init.d/ipvsadm start

# chkconfig ipvsadm save

# chkconfig ipvsadm on

# tcpdump -n -i any port 80 (for testing)

# ipvsadm -L -n (To show the number of active connections)

-A, –add-service
-L, -l, –list
-t, –tcp-service service-address
-s, –scheduler scheduling-method
-w, –weight weight

–stats
Output of statistics information. The  list  command  with  this
option  will  display the statistics information of services and
their servers.

–rate
Output of rate information. The list command  with  this  option
will  display  the rate information (such as connections/second,
bytes/second and packets/second) of services and their  servers.

Scheduling Method :-

1. Round-Robin :- Distributes Job Equally (rr)
2. WRR :- Weighted Round Robin
3. LC :- Least Connection
4. WLC :- Weighted Least Connection
5. LBLC :- Locality bases Least Connection
6. LBLCR :- Locality Bases least Connection with Replication
7. DH :- Destination Hashing, use statically assigned hash table
8. SH :- Source Hashing, Use Statically assigned hash table
9. SED :- Shortest Expected Delay
10. NG :- Never Queue

Advertisements

March 11, 2012 Posted by | Apache, Cluster, LVS | , , , , | Leave a comment