[RADIATOR] FarmChildHook to rotate AuthPort, AcctPort and DBSource

Christian Kratzer ck-lists at cksoft.de
Tue Dec 1 08:18:40 CST 2015


Hi Heikki,

sorry about the delay in answering this.

On Wed, 4 Nov 2015, Heikki Vatiainen wrote:
> On 13.10.2015 15.45, Christian Kratzer wrote:
>
>> 3. Also note the rather high number fo MaxFailedRequests in HASHBALANCE.  I saw the backends get marked bad instantly when activating this in a high load enviroment with a low number fo MaxFailedRequests.  I never quite found out why but assume this was due to interfering with in progress EAP transactions.  A value of 10 keeps the hashbalance happy until the backend really dies.  YMMW of course.
>
> That's possible. See EAPErrorReject configuration parameter for more
> info, but the default is to drop many EAP related requests when there's
> an error.
>
>>       # walk over all AuthBy and Hash database credentials by farmInstance
>>       foreach my $auth (@{$main::config->{AuthBy}}) {
>>          my $id = $auth->{Identifier};
>
> You could also fetch the AuthBy handle directly with something like this:
>
> my $id = 'SQLauth';
> my $auth = Radius::AuthGeneric::find($id);
>
> Then continue as below (maybe add error check if $auth is not found)

that is also a valid point and should perhaps go in additionally.

We use this in multiple different configs so I itentionally put in the
loop over all authby so it would reach all the various database
connections.

It really depends a lot on how people want to use this and goodies is
the first place I look when I try to find ways to do things. That is
before I go into the sources.

>
>>          foreach my $key (qw(DBSource DBUsername DBAuth)) {
>>              if ($auth->{$key}) {
>>                  my $database_count = @{$auth->{$key}};
>>                  $auth->{$key} = [ $auth->{$key}[ ($main::farmInstance-1)%$database_count ] ];
>>                  &main::log($main::LOG_INFO, "farmchild.hook: AuthBy: $id, $key: ".$auth->{$key}[0] );
>>              }
>>          }
>
> Remove one } here too.
>
>>
>>       return;
>> }
>
> Please let me know if the original should go into goodies or if there's
> anything you'd like change before it gets added.


if it is ok with you just let it go in as it is.

That's the way I currently use it.  If I change something I would need
to retest and I do not currently have the time.

But please feel free to change or add anything you consider worthwhile.

Greetings
Christian

-- 
Christian Kratzer                   CK Software GmbH
Email:   ck at cksoft.de               Wildberger Weg 24/2
Phone:   +49 7032 893 997 - 0       D-71126 Gaeufelden
Fax:     +49 7032 893 997 - 9       HRB 245288, Amtsgericht Stuttgart
Mobile:  +49 171 1947 843           Geschaeftsfuehrer: Christian Kratzer
Web:     http://www.cksoft.de/


More information about the radiator mailing list