irule for default and backup secondary pool

Need help fixing the second half of this irule, after the redirect.

I will be adding a new pool as a backup pool incase the default pool members al all down. So is defaul HQ-Pool is down then use SC-Pool.

!--------------------

when HTTP_REQUEST {

HTTP::redirect ]

}

If This is default pool

pool HQ-Pool

if all pool members are down

then else

pool SC-Pool

use this secondary backup pool

Gilbert,

I’m wondering whether both a redirect to https and checking about the pool members will work in a single iRule. I’m sure I will be corrected if wrong but I’d add the redirect to the http virtual server (which I presume you’ve got) and then have another iRule for the pool selection on the https virtual server.

when CLIENT_ACCEPTED {
  if {[active_members HQ-Pool] < 1}{
     Send to the backup pool
    pool SC-Pool
  } 
  else {
     Send to the default pool
    pool HQ-Pool
}

Does this help your scenario?

N

You wouldn’t want to use that redirect code on your production virtual server. It would cause an infinite redirect loop. Instead put it on an empty port 80 virtual with the same IP address.

Here’s another version of code that might also work for you (on the production virtual):

when RULE_INIT {
set static::BACKUP_POOL "local1-pool"
}
when HTTP_REQUEST {
set default_pool [LB::server pool]
log local0. "in event: $default_pool"
if { [active_members $default_pool] < 1 } {
log local0. "no members in default pool"
if { [active_members $static::BACKUP_POOL] < 1 } {
log local0. "no members in backup pool"
HTTP::respond 200 content "No pool members available"
} else {
pool $static::BACKUP_POOL
}
}
}

Remember to remove or comment out the log statements and set the name of the backup pool in RULE_INIT. Because the pool status check is happening in HTTP_REQUEST, you can send the user a message if the backup pool is also down. If you remove the HTTP::respond line you can use this same code in a CLIENT_ACCEPTED event.

Gilbert

Or do the redirect using a http class profile instead of using an irule - again on a http virtual and not the https one.

Rgds

N

I really need to have the redirect and is already running in this production virtual server with the default pool being HQ-Pool.

Just need to add a function to use another pool incase the default pool is down for what ever reason, i was thinking an irule would be the best way.

Correction, yes, the redirect irule is not in this vip..You all are correct…I only need the use default HQ-Pool, otherwise if down then use backup pool SC-Pool.

why couldn’t you use priority activation - using one pool - just have your production members at a higher priority, if they aren’t available, your traffic will route to the standby member(s)

As said, go try using the “priority-group” parameter.

i.e. you can set “priority-group 8” for default pool members and “priority-group 4” for backup members.

You can control how many members go down untill backup members become service ready as well.

Definately go with Priority Groups. Another problem with using two groups is that the entire VIP would be taken down if you configure a default Pool for it - regardless of available members of the alternate Pool. If you don’t configure a default Pool the VIP health would always be unknown…

Ok, thanks I’ll check into priority groups. Always a first time to try.