LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [lvs-users] misc_check healthchecker question

To: stabilizr1@xxxxxxxxx, "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [lvs-users] misc_check healthchecker question
From: Thomas Pedoussaut <thomas@xxxxxxxxxxxxxx>
Date: Wed, 16 Jul 2008 10:40:04 +0100
T Billings wrote:
> Hi,
>
> To add to my question, I can see in the logs that it's activating the 
> healthchecker and have verified the misc_path script returns either a 0 if 
> fine or a 1 if failed.
>   
We are talking here of return code, not a return value.
a simple script that does
echo 1
will have a return code of 0 (success, the code ran successfully) not 1 
(the output of the script).

For example I have a dynamic script like this.
ret=$(mysql -u keepalived -pMYPASSWORD -N -h $1 -e "select val from 
keepalived where srv=\"$1\";" LB)
if [ $ret -gt 1 ]
then
    exit $ret
else
    exit 1
fi

To check return code you have to do:
myscript.sh
echo $?

and that will output the return code of the previous command.

> Thanks.
>
>
> --- On Tue, 7/15/08, T Billings <stabilizr1@xxxxxxxxx> wrote:
>
>   
>> From: T Billings <stabilizr1@xxxxxxxxx>
>> Subject: misc_check healthchecker question
>> To: keepalived-devel@xxxxxxxxxxxxxxxxxxxxx, lvs-users@xxxxxxxxxxxxxxxxxxxxxx
>> Date: Tuesday, July 15, 2008, 10:09 AM
>> Hi,
>>
>> I'm trying to load balance to some mysql servers using
>> Keepalived/LVS and am having some issues getting the health
>> checker to work.   I've configured each real server with
>> a misc_check healchecker which is a script that does runs
>> through some tests and returns a 0 for success and 1 for
>> failure.  Problem is that when it returns a 1 keepalived
>> does not remove the system from service.   What am I
>> missing?  Below is what is currently in my keepalived.conf
>> but I've also had misc_timeout and misc_dynmic in there
>> as well as weight = 1 defined before the misc_check.
>>
>> Thanks in advance for your help.
>>
>>
>> virtual_server 123.45.67.80 3306 {
>>         delay_loop 30
>>         lb_algo rr
>>         lb_kind DR
>>         protocol TCP
>>
>>         real_server 123.45.67.81 3306 {
>>                 MISC_CHECK {
>>                         misc_path
>> /etc/keepalived/bin/db_check.sh
>>                         }
>>         }
>> }
>>     
>
>
>       
>
> _______________________________________________
> 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>