Using piranha to build a Linux virtual Server (LVS) Clustered environment

Source: Internet
Author: User

The recent performance comparison test of the LVS cluster approach has encountered some strange problems in configuring the IP tunneling mode:

1) After stopping the LVS service, the virtual IP is not released (it seems that only restart the server can be released, restart the network card, empty the routing table, restart the switch, etc. are not valid);

2) Load imbalance (sometimes the pressure is all pressed on one of the members, and sometimes normal);

A manual configuration was done before the "direct route" method was tested, and the configuration was unsuccessful and no problems were found. And this time using IP tunneling way so many problems, it must be a configuration problem.

Official introduction of a configuration tool: Piranha. The CentOS installation CD is also self-equipped, so try it out, very convenient! Recommended for everyone to use. After all, this thing released, even if the error is not too far, the bug on the other side. Who can be sure that our manual configuration is not wrong or bug?

Piranha provides a set of solutions, including monitoring of service status, monitoring of business servers, and hot provisioning of the load server itself. Basic structure schematic:

650) this.width=650; "class=" blogimg "src=" http://www.linuxidc.com/upload/2010_10/101025065598541.png "border=" 0 " Style= "border:0px;" alt= "101025065598541.png"/>


Installation is simple:

Yum install ipvsadm modcluster Piranha system-config-cluster php php-cli Php-common
Piranha is a Web service (apache+php), you need to set the login password after the installation is complete:/USR/SBIN/PIRANHA-PASSWD, the user name is Piranha.

1. Start Web Service: Service Piranha-gui start

2. Start the LVS daemon: Service pulse start

3, can visit: http://127.0.0.1:3636.

detailed configuration can refer to RedHat Official website Description, a little understanding of LVS, search is easy to get started.

Here I would like to add a realserver service configuration. Www.linuxidc.com because the piranha itself provides the configuration of the virtual server itself, it does not provide a realserver configuration. Some of the articles found on the Internet only introduced the Realserver configuration, not enough for mass production use.

First, the LVS server needs to execute the following script if it modifies the configuration reboot:

Killall-9 Nanny
Service Pulse Restart
Service Piranha-gui Restart
If the client uses direct routing, the Service script is as follows:

#!/bin/bash
# realserver Service script, direct routing method
web_vip=192.168.10.31

start () {
Ifconfig lo:0 $WEB _vip netmask 255.255.255.255 Broadcast $WEB _ VIP
/sbin/route add-host $WEB _vip dev lo:0
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/ Proc/sys/net/ipv4/conf/lo/arp_announce
Echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/ Proc/sys/net/ipv4/conf/all/arp_announce
sysctl-p >/dev/null 2>&1
echo "Realserver Start OK [LVS_DR]"
}

Stop () {
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce
/sbin/ifconfig lo:0 Down
/sbin/route del-host $WEB _VIP
Sysctl-p >/dev/null 2>&1
echo "Realserver stoped [Lvs_dr]"
}

Restart () {
Stop
Start
}

Case $ in

Start
Start
;;
Stop
Stop
;;
Restart
Restart
;;
Status
/sbin/ifconfig
;;
*)
echo "Usage: $ {Start|stop|restart|status}"
Exit 1
Esac
If the client uses IP tunneling, the service script is as follows:

#!/bin/bash
# Business Server LVS service script, IP tunneling mode
web_vip=192.168.10.31

Start () {
Ifconfig tunl0 $WEB _vip netmask 255.255.255.255 broadcast $WEB _VIP
/sbin/route add-host $WEB _vip Dev tunl0
echo "1" >/proc/sys/net/ipv4/conf/tunl0/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/tunl0/arp_announce
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
Sysctl-p >/dev/null 2>&1
echo "Realserver Start OK [Lvs_tun]"
}

Stop () {
echo "0" >/proc/sys/net/ipv4/conf/tunl0/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/tunl0/arp_announce
echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce
Ifconfig tunl0 Down
/sbin/route del-host $WEB _VIP
Sysctl-p >/dev/null 2>&1
echo "Realserver stoped [Lvs_tun]"
}

Restart () {
Stop
Start
}

Case $ in

Start
Start
;;
Stop
Stop
;;
Restart
Restart
;;
Status
/sbin/ifconfig
;;
*)
echo "Usage: $ {Start|stop|restart|status}"
Exit 1
Esac
Because the author does not use the NAT method, this is not described here. Welcome the vast number of users to add.


This article is from the "lake and Laughter" blog, please make sure to keep this source http://hashlinux.blog.51cto.com/9647696/1758913

Using piranha to build a Linux virtual Server (LVS) Clustered environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.