[dnsdist] server policy to failover to another pool

Justin Valentini justin.valentini at oracle.com
Wed Oct 4 21:05:43 UTC 2017


Hi,

I'm trying to create a Lua server policy to use the least outstanding 
policy on one pool but send traffic to another pool if none of the 
servers in the first pool are up.

Here's my Lua code which is *not* working:

function useLocalBindAsLastResort(servers, dq)
   primaryServer = leastOutstanding.policy(getPoolServers("primary"), dq)
   if primaryServer
   then
     return primaryServer
   else
     return leastOutstanding.policy(getPoolServers("secondary"), dq)
   end
end
setServerPolicyLua("useLocalBindAsLastResort", useLocalBindAsLastResort)

The problem seems to be with the conditional as it never seems to hit 
the secondary pool, even when I test it by manually setting all servers 
in the primary pool to DOWN. I'm not quite sure what the check needs to 
look like though. Thoughts?

Thanks,

Justin



More information about the dnsdist mailing list