Forum Discussion
Pool member failback
Hi guys,
the following irule logic inspired by some of the comments above, seems a bit neater and should do the trick. You will need to adjust the pool names and pool member counts as required, and you can of course perform more complex calculations if you prefer.
I did some basic testing, but i can't promise i caught all potential errors, so make sure to give it a whirl in a test environment first.
when RULE_INIT {
set static::pp "webpool"
set static::bp "backupwebpool"
set static::flag "flag"
}
when CLIENT_ACCEPTED {
if { [table lookup $static::flag] eq "backup" && [active_members $static::pp] < 1 } {
we're in backup mode
log local0. "backup mode"
pool $static::bp
}elseif { [active_members $static::pp] >= 1} {
active mode
log local0. "going back to active mode"
table set $static::flag "active"
pool $static::pp
}else {
backup mode needs to be enabled
log local0. "enabling backup mode"
table set $static::flag "backup"
pool $static::bp
}
}
Hi FKnuckles,
I'm a big fan of the Priority Based Activation feature, but unfortunately you can't use this feature for the given requirement (different availability thresholds for failover and failback).
Well, you're code uses just 3 instead of 4 different conditions and looks therefor indeed much cleaner. But on the other hand it does not cover the requirements of the OP and produces a slightly higher overhead. Let me try to compare the different iRules...
Active Operation Scenario
Your code:
if [table lookup $static::flag] eq "backup"
if [active_members $static::pp] >= 1
table set $static::flag "active"
pool $static::pp
My Code:
if [table lookup "status_$static::primary_pool"] eq "backup"
if [active_members "$static::primary_pool"] > 1]
pool "$static::primary_pool"
Performance Difference: Your code requires one additional table command execution.
Functional Difference: None
Active Operation Failover Scenario
Your code:
if [table lookup $static::flag] eq "backup"
if [active_members $static::pp] >= 1
table set $static::flag "backup"
pool $static::bp
My Code:
if [table lookup "status_$static::primary_pool"] eq "backup"
if [active_members "$static::primary_pool"] > 1]
table add "status_$static::primary_pool" "backup" indefinite indefinite
pool "$static::backup_pool"
Performance Differences: None
Functional Difference: None
Backup Operation Scenario
Your code:
if [table lookup $static::flag] eq "backup"
if [active_members $static::pp] < 1
pool $static::bp
My Code:
if [table lookup "status_$static::primary_pool"] eq "backup"
if { [active_members "$static::primary_pool"] >= 4]
pool "$static::backup_pool"
Performance Differences: None
Functional Difference: The OPs requirement is not covered. The requirement for triggering the failback is [active_members $static::pp] = 4 nodes.
Backup Operation Failback Scenario
Your code:
if [table lookup $static::flag] eq "backup"
if [active_members $static::pp] < 1
if [active_members $static::pp] >= 1
table set $static::flag "active"
pool $static::pp
My Code:
if [table lookup "status_$static::primary_pool"] eq "backup"
if { [active_members "$static::primary_pool"] >= 4]
table delete "status_$static::primary_pool"
pool "$static::primary_pool"
Performance Differences: Your code requires one additional [active_members $static::pp] command execution.
Functional Difference: The OPs requirement is not covered.
Cheers, Kai
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com