Forum Discussion

GaryZ_31658's avatar
GaryZ_31658
Historic F5 Account
Jul 14, 2008

Vip target VIP

All,

 

 

I have a scenario where I want to LB "pods" of servers using a Master VIP. I could have many nodes in each pool and do not want to disable each individual node when we take a "pod" offline. It would be a simple task to disable either the pool or the VIP as a whole rather than each individual node.

 

 

iRule logic: In the iRule below, we round robin connections to a specific VIP (one defined for each pod). Once at the pool, we set a unique cookie and persist back to the pod as required (each VIP inserts a cookie "my_cookiePodx").

 

 

Question: Can I monitor the pool (or VIP) in the iRule for availability so if a pod is offline, the VIP won't send traffic to the disabled pod virtual? I was thinking of using when LB_Failed but the docs suggest fail detection between 9 and 45 seconds. My thoughts are if the VIP is offline, LTM would send a reset and the browser would simply retry. This seems faster but it also seems a little dirty.

 

 

when RULE_INIT {

 

set ::cnt 0

 

}

 

 

when HTTP_REQUEST {

 

set reqcookie [findstr [HTTP::cookie names] "my_cookie"]

 

if { $reqcookie starts_with "my_cookie"} {

 

set podcookie [findstr $reqcookie "my_cookie" 9 " "]

 

set podvip [findclass "$podcookie" $::pod_vip " "]

 

virtual $podvip

 

} else {

 

incr ::cnt

 

if { $::cnt <= 3 } {

 

set ::cnt 1

 

}

 

switch $::cnt {

 

1 { virtual pod1 }

 

2 { virtual pod2 }

 

3 { virtual pod3 }

 

}

 

}

 

}

13 Replies