Re: Service failover not happenning.
Ali Abbas <[email protected]> Sat, 7 Jan 2012 17:19:07 +0100
| Newsgroups | gmane.linux.keepalived.announce |
|---|---|
| Message-ID | <CALRsP6RqwcGecNX=zZ3Q1kVsiKG1oBwAqwL6PVqXAb29QgChfg@mail.gmail.com> |
Hi,
>> (...)
>> vrrp_script check_memcache {
>> script "pkill -0 memcached"
>> interval 2
>> weight 2
>> }
>> (...)
>>=A0 Does anybody know what I'm doing wrong?
The problem are the priorities you assigned to both Master/Backup and
the weight value you assigned to the memcache check script. From what
I can see on the backup adjacent VIP in your master configuration, you
are likely using 50 as backup priority for the first VIP.
Remember for each exit value, the priority is decreased (code status
-1) and increased (code status 0) by the weight value you assigned, in
your case: -/+ 2
- The master priority would have increased by 2 =3D> 102 from 100 and
fall-back to 100 once memcached is killed.
- The backup priority would be on 52
In any case, the master priority is still higher than the backup and
reason why the VIP never fall-backs to the backup instance. If you run
a tcpdump, you can see who is advertising to 224.0.0.18 and what the
priority is.
To fix this, set the backup priority to 100, master to 101 and leave
weight by 2 as an example - the math is simple, so choose the values
that fits best your purposes especially if you add more instances.
Cheers,
--
Ali Abbas
Blog: http://alouche.net
On Sat, Jan 7, 2012 at 2:00 AM, Mitch Patenaude
<[email protected]> wrote:
>
> I've got two boxes running memcached. =A0I want them to act as failover f=
or each other. =A0I've set up keepalived to handle moving 2 VIPS between th=
e boxes. I can force a failover by shutting down keepalived, but not by shu=
tting down memcached. Here's the config for one of the boxes: (IPs and some=
details changed)
>
> global_defs
> {
> notification_email
> {
> [email protected]
> }
> notification_email_from [email protected]
> smtp_server 192.168.1.9
> smtp_connect_timeout 30
> router_id memcache01
> }
>
> vrrp_script check_memcache {
> script "pkill -0 memcached"
> interval 2
> weight 2
> }
>
> vrrp_instance MemcacheA {
> interface eth0
> state MASTER
> virtual_router_id 41
> priority 100
> authentication {
> auth_type PASS
> auth_pass hackme
> }
> virtual_ipaddress {
> 192.168.1.28 dev eth0
> }
> smtp_alert
> track_script {
> check_memcache
> }
> }
>
> virtual_server 192.168.1.28 11211 {
> delay_loop 6
> lb_algo rr
> lb_kind TUN
> persistence_timeout 50
> protocol TCP
> sorry_server 192.168.1.29 11211
> real_server 127.0.0.1 11211 {
> weight 1
> TCP_CHECK {
> connect_timeout 3
> }
> }
> }
>
> vrrp_instance MemcacheB {
> interface eth0
> state BACKUP
> virtual_router_id 42
> priority 50
> authentication {
> auth_type PASS
> auth_pass hackme
> }
> virtual_ipaddress {
> 192.168.1.29 dev eth0
> }
> smtp_alert
> track_script {
> check_memcache
> }
> }
>
> virtual_server 192.168.1.29 11211 {
> delay_loop 6
> lb_algo rr
> lb_kind TUN
> persistence_timeout 50
> protocol TCP
> sorry_server 192.168.1.28 11211
> real_server 127.0.0.1 11211 {
> weight 1
> TCP_CHECK {
> connect_timeout 3
> }
> }
> }
>
> The other box is pretty much the same except that the MASTER/BACKUP and p=
riorities are switched. I have two mechanisms that should allow for failove=
r. =A0First the track script should check to see if memcached is running, a=
nd second the sorry_server should kick in when the primary isn't answering,=
but neither of these mechanisms appear to be working. =A0This is running k=
eepalived 1.2.1 on CentOS 5.4 on kernel=A02.6.18-164.el5. =A0Does anybody k=
now what I'm doing wrong?
>
> Thanks,
> =A0 -- Mitch Patenaude =A0 [email protected]
>
> -------------------------------------------------------------------------=
-----
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual
> desktops for less than the cost of PCs and save 60% on VDI infrastructure
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> _______________________________________________
> Keepalived-announce mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/keepalived-announce
>
---------------------------------------------------------------------------=
---
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual =
desktops for less than the cost of PCs and save 60% on VDI infrastructure =
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox