LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [lvs-users] Disable a real server

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [lvs-users] Disable a real server
From: Diego Bello <dbello@xxxxxxxxx>
Date: Fri, 15 Jan 2010 10:26:57 -0300
On Thu, Jan 14, 2010 at 6:21 PM, L.S. Keijser <leon@xxxxxxxx> wrote:
>
> On Thu, 2010-01-14 at 09:45 -0300, Diego Bello wrote:
> > Hi guys,
> >
> > I just subscribed to this list and this is my first question: Is there a way
> > to automatically disable a real server?
>
> Yes. You could let a program like ldirectord take care of that. I
> believe keepalived can do the same job.
>
> > What I need to do is a postgres virtual server, whose realservers' databases
> > will be updated once a week. The idea is to disable a real server and
> > update, then enable it again. I know I can do it using piranha, but I need
> > to do it with a script or something.
>
> I'm not sure i understand what you're trying to do here. Do you want to
> have the realserver disabled automatically or manually? If the latter,
> you could use ipvsadm to alter the LVS table. Or by a script like this
> for example (untested) :
>
> #!/bin/bash
> RS=$1
> STATE=$2
> PORT=5432
> case $2 in
>  disable)  ipvsadm -e -t ${VS}:${PORT} -r ${RS}:${PORT} -w 0
>            ;;
>  enable)   ipvsadm -e -t ${VS}:${PORT} -r ${RS}:${PORT} -w 1
>            ;;
>  *)        exit 1
>            ;;
> esac
>
> run `./this-script 192.168.1.100 disable` , then update your db, and run
> `./this-script 192.168.1.100 enable` to continue business as usual.
>

Thanks!

I didn't know about ipvsadm as I was using primarily piranha to
configure the cluster, but now I see that this tool is just what I
need to manage Real Servers manually.

Just one thing, when using the command, the disabled real server
changed the forward method to Route instead of masquerade, as saw with
"ipvsadm -l". This caused connection time out, but I don't know
exactly why.

Original:
TCP  m104_vpn.airsage.com:post wlc
  -> m104.airsage.com:postgres  Masq    1      0          1
  -> m034.airsage.com:postgres  Masq    1      0          1

Disabled:
TCP  m104_vpn.airsage.com:post wlc
  -> m104.airsage.com:postgres Route   0      0          3     <------
Note the Route Forward method
  -> m034.airsage.com:postgres  Masq   1      0          2


The fix was to read the man page and find the -m parameter:  ipvsadm
-e -t SERVICE_IP:5432 -r m104_IP -w 1 -m
Fixed:
TCP  m104_vpn.airsage.com:post wlc
  -> m104.airsage.com:postgres Masq    1      0          2
  -> m034.airsage.com:postgres Masq    1      0          1


Now I can manage Real Servers at will :D

>
> If automatically, in the case a db is simply not accessible by a tcp
> connection for example, a program such as ldirector could help you.
>
> > The only way I see is to change the router's configuration (lvs.conf) and
> > reload piranha, but I'm not totally sure if it's a good idea to change the
> > configuration only for that, considering that the cluster also works with
> > more virtual servers.
>
> I don't know piranha (check redhat's mailinglist(s) for that) so i don't
> know if it had its own build-in healthcheck mechanism.

Piranha is a web tool to configure a LVS cluster, services and real servers.

> > Is there any other way?
>
> It's linux, there's always another way :)
>
> --
> Léon
>
>

Regards,
--
Diego Bello Carreño

_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Send requests to lvs-users-request@xxxxxxxxxxxxxxxxxxxxxx
or go to http://lists.graemef.net/mailman/listinfo/lvs-users

<Prev in Thread] Current Thread [Next in Thread>