There are quite a few howto's for LVS, but all of them are quite extensive. To be honest; you'll need to read them at some point, but for now let's try to make a very minimal howto for setting up LVS.
Configure the director/loadbalancer to have two NIC's. One side on a routable network, the other side connected to the machine running the services, called realservers.
# chkconfig ipvsadm on
# sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/' /etc/sysctl.conf
# sysctl -pIf you want your realservers to be able to use the internet, execute these lines on the director. Replace YOURREALSERVERLAN for the network address of the network where the real servers are located, for example. 192.168.1.0
# iptables -A POSTROURING -s YOURREALSERVERSLAN/24 -j MASQUERADE
# service iptables saveFill in the blanks for PUBLICIP and REALSERVERIP. If you would like to add more servers to this virtual server, just repeast the last line a few times, changing the REALSERVERIP every time.
# echo "-A -t PUBLICIP:80" > /etc/sysconfig/ipvsadm
# echo "-a -t PUBLICIP:80 -r REALSERVERIP -m" >> /etc/sysconfig/ipvsadm
# service ipvsadm startFrom a machine other then the redirector and/or the realserver, visit the ipaddress of your virtual ip.
N.B. I have spent quite some time trying to access the loadbalancer from the loadbalancer; this does not work.
Comments
Load balancing with the use
Load balancing with the use of sysadmin can be pretty difficult sometimes. I think that there are a lot of people who are experience the same problem. Thank you for posting this. It will help a lot of people.
Paul
dedicated servers
Hi, This was really helpful.
Hi,
This was really helpful. Thank you very much for your post. Keep it up
Sreedevi
Thanks for your post.Nice
Thanks for your post.Nice webdesign.