[lvs-users] Disable a real server

L.S. Keijser leon at linux.nl
Thu Jan 14 21:21:53 GMT 2010


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.

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 :)

-- 
Léon





More information about the lvs-users mailing list