November 24, 2024, 03:28:47 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: How to install LVS(Linux Virtual Server) on Redhat 9 Pro  (Read 11071 times)

Offline hanz

  • Linux Noob !
  • *
  • Posts: 4
How to install LVS(Linux Virtual Server) on Redhat 9 Pro
« on: May 18, 2004, 10:13:35 AM »
Can anyone give me the details how to install,configure etc lvs(Linux Virtual Server) on Redhat 9 Professional ??????

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
How to install LVS(Linux Virtual Server) on Redhat 9 Pro
« Reply #1 on: May 18, 2004, 03:33:41 PM »
Well.. I would Like to know y u need to configure virtual server.. Do u any idea for it is used..
BTw.. that is a long procedure..

Hint.. u need IPVsadm

Offline hanz

  • Linux Noob !
  • *
  • Posts: 4
How to install LVS(Linux Virtual Server) on Redhat 9 Pro
« Reply #2 on: May 19, 2004, 01:48:05 AM »
actually I want to do a load balancing on my web server...currently I have 300 users that access to my web server .The increse of user access to the web server...make my web server hang....so i have to restart my web server service...

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
How to install LVS(Linux Virtual Server) on Redhat 9 Pro
« Reply #3 on: May 29, 2004, 05:59:31 AM »
Ok..
First little concept..
Here we make a virtual server which sits in front all real servers and so that we can add , remove real servers. And this virtual server also do load balancing for the real servers.

Ok
That is long procedure.. Let me try to summerize it..

1. Make sure your ipchains etc. are off. And Iptables are on.
2. Second you have to enable ip forwarding.. that is  you can add a line in the /etc/rc.d/rc.local
Also we will add few other lines which will do masquerading for external interface ( Here I am assuming that eth1 is connected to internet.
Code: [Select]
echo > 1 /proc/sys/net/ipv4/ip_forward
iptables -t nat -P POSTROUTING DROP
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

Now we have to configure ipvsadm, utility to do virtual server things. See linuxvirtualserver.org to get this, also it may need to patch your kernel , get more details from there.

So wht is next is to assign private IP to all your real server and set the gateway on them as the internal IP of the virtual server. Also assign public ip to external interface to the virtual server ie. which is connected to the internet.
Next is to assign alogorithm to ports. like wht what algorithm of virtual server will use for which protocol. Here see ipvsadm man page for more details. Lets assume that  we are assigning wrr and wlc algorithm to port 21 and port 80 resp. means ftp and http traffic. so command wil be
Code: [Select]
ipvsadm -A -t xxx.xxx.xxx.xxx:21 -s wrr
ipvsadm -A -t xxx.xxx.xxx.xxx:80 -s wlc
Here xxx.xxx.xxx.xxx is your external IP address of your virtual server.
Now lets assume that our real servers have IP 192.168.5.2 which will handle ftp request and 192.168.5.3 which will handle http reqests, we will also distribute the http request to both servers.. and 192.168.5.1 one is the internal address of your virtual server which is set as gateway in both real servers.

Now adding the real servers to vitual server ..
Code: [Select]
ipvsadm -a -t xxx.xxx.xxx.xxx:80 -r 192.168.5.3:80 -m
ipvasdm -a -t xxx.xxx.xxx.xxx:80 -r 192.168.5.2:80 -m -w 2
ipvsadm -a -t xxx.xxx.xxx.xxx:21 -r 192.168.5.2:21 -m
Here http will get distributed along both real server and ftp will go to only 192.168.5.2

I don't this it is comprehensive but it can give a good idea that how to do it in linux. So after  every thing is fine on accessing xxx.xxx.xxx.xxx all request will be forwarded to real servers as per the algorithm.

Offline lnx_wiz

  • New Member
  • Posts: 1
How to install LVS(Linux Virtual Server) on Redhat 9 Pro
« Reply #4 on: May 29, 2004, 06:08:12 AM »
Ok. Check out this link below. I am sure this will help you set VIRTSERVER up.

http://www.tldp.org/HOWTO/Virtual-Services-HOWTO-3.html

Offline hanz

  • Linux Noob !
  • *
  • Posts: 4
How to install LVS(Linux Virtual Server) on Redhat 9 Pro
« Reply #5 on: June 01, 2004, 02:15:51 AM »
Thanks guys....I will install the lvs on my machine...I will come again if i got any problem