Forum Discussion
Kram_259300
Nimbostratus
Aug 18, 2016Pool member failback
I have a requirement to select pool member based on the availability.
Primary pool has 4 servers & backup pool has 2 servers. I know failover can be triggered based on the prioriy group or writi...
Kai_Wilke
MVP
Aug 18, 2016Hi Kram,
you may use the iRule below as a starting point. The iRule uses the table command to switch between a primary/backup mode to be able to apply different rule sets...
when RULE_INIT {
set static::primary_pool "pool_a"
set static::backup_pool "pool_b"
}
when CLIENT_ACCEPTED {
Check session table if backup mode is currently active
if { [table lookup "status_$static::primary_pool"] eq "backup" } then {
Backup mode is currently active. Applying Backup mode availability requirements. Check if primary pool has equal or more than 4 members.
if { [active_members "$static::primary_pool"] >= 4] } then {
Primary pool has equal or more than 4 members. Switching back to primary pool and disable Backup mode.
table delete "status_$static::primary_pool"
pool "$static::primary_pool"
} else {
Primary pool has less than 4 members. Using backup pool and keeping Backup mode active...
pool "$static::backup_pool"
}
Exit the script...
return
}
Backup mode is currently not active (default). Applying normal availability requirements. Check if primary pool has more than 1 members.
if { [active_members "$static::primary_pool"] > 1] } then {
Primary pool more than 1 member. Using primary pool and keeping Backup mode disabled...
pool "$static::primary_pool"
} else {
Primary pool less than 2 available member. Using the backup pool and enable Backup mode in session table...
table add "status_$static::primary_pool" "backup" indefinite indefinite
pool "$static::backup_pool"
}
}
Update: Changed the order of the script to make it easier to understand. Added additional comments, to explain what the purpose of each line is...
Cheers, Kai
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects