Forum Discussion
iRule to disable a pool to new connections
Note: Calling LB::down in an iRule triggers an immediate monitor probe regardless of the monitor interval settings.
Fair enough. So then you have a few more options:
-
Ignore the log statements
-
Turn down logging
-
Add another log statement just before LB::down to indicate that next statements are by design
-
Use the user_alert method
-
Send users to a different pool during the down period (same members minus the ones you want to remove). Here's an iRule example of what that might look like:
when RULE_INIT { user-defined: start of DOWN time set static::START_OFF_TIME "06:33 AM" user-defined: end of DOWN time set static::END_OFF_TIME "10:00 AM" user-defined: DOWN pool set static::DOWN_POOL "local-pool-minus2" } when CLIENT_ACCEPTED { get pool assigned to the VIP (and strip off partition) set default_pool [string map {"/Common/" ""} [LB::server pool]] recreate the persistence cookie name set persistcookie "BIGipServer${default_pool}" } when HTTP_REQUEST { set start_off_time [clock scan $static::START_OFF_TIME] set end_off_time [clock scan $static::END_OFF_TIME] set now [clock seconds] if the persistence cookie doesn't exists, and inside DOWN time - send to DOWN pool if { not ( [HTTP::cookie exists $persistcookie] ) and (( [expr $now > $start_off_time] ) and ( [expr $now < $end_off_time] )) } { pool $static::DOWN_POOL } }
First, set a default cookie persistence profile on the VIP. If the request is made by a new user (with no existing persistence cookie) during the down period, send them to the designated DOWN pool. If a user has an existing session (has a persistence cookie for the default pool), continue to send them to the default pool. This will allow you to remove the servers without disrupting existing sessions.
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