Update control with redundant sql query

Fajar A. Nugraha list at fajar.net
Thu Jun 28 22:18:20 CEST 2012


On Fri, Jun 29, 2012 at 12:09 AM, lscrlstld <lscrlstld at gmail.com> wrote:
> Hi,
>
> I use the policy configs to provide redundant and load-balance to update
> the pool-name.
>
> It´s work fine!

Does it?

> The policy.conf
> policy {
>        update_ctlr_PN1 {
>                update control {
>                        Pool-Name := "%{sql01:select poolname from
> radpoolname where nasipaddress=\"%{NAS-IP-Address}\"}"
>                }
>        }
>        update_ctlr_PN2 {
>                update control {
>                        Pool-Name := "%{sql02:select poolname from
> radpoolname where nasipaddress=\"%{NAS-IP-Address}\"}"
>                }
>        }
>        update_ctlr_PN {
>                redundant-load-balance {
>                                update_ctlr_PN1
>                                update_ctlr_PN2
>                }
>        }
> }

last time I check the "%{sql" block does NOT return an error if the
sql server is dead. So your "load-balance" part definitely works, but
I wouldn't be so sure about the "redundant" part. Try killing one of
the sql servers and see what happens.

IIRC I had to explicitly hack a query so it would return some value
(e.g. NOTFOUND, or whatever) when it would usually return zero rows.
That way, if the "%{sql" block returns an empty string, I know
something is wrong and I need to ask the next server. That method
works, but it doesn't provide load balance.

-- 
Fajar


More information about the Freeradius-Users mailing list