Re: [lvs-users] Disable a real server

To: " users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [lvs-users] Disable a real server
From: "L.S. Keijser" <leon@xxxxxxxx>
Date: Thu, 14 Jan 2010 22:21:53 +0100
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) :

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

run `./this-script disable` , then update your db, and run
`./this-script enable` to continue business as usual.

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. 

> Is there any other way?

It's linux, there's always another way :)


Please read the documentation before posting - it's available at: mailing list - lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Send requests to lvs-users-request@xxxxxxxxxxxxxxxxxxxxxx
or go to
<Prev in Thread] Current Thread [Next in Thread>