Forum Discussion
Ian_Smith
Mar 20, 2010Ret. Employee
this is a rule that would do this for v10.1 platforms:
use a class list to tie pool member ips to a physical node:
class cluster_list {
{
"10.200.30.12" { "1" }
"10.200.30.13" { "2" }
"10.200.30.15" { "1" }
"10.200.30.16" { "2" }
"10.200.30.17" { "1" }
"10.200.30.18" { "2" }
}
}
++++ then put the rule on all virtual servers
++++ change the virtual server and pool member names
when CLIENT_ACCEPTED {
switch [string tolower [virtual name]] {
http_test_2 {set p http_pool_2}
http_test_3 {set p http_pool_3}
}
if {[table lookup -subtable [IP::client_addr] "cluster"] ne "" } {
foreach m [lindex [active_members -list $p] {} ] {
if { [getfield [class lookup [getfield $m " " 1] cluster_list] " " 1] eq [table lookup -subtable [IP::client_addr] "cluster"] } {
pool $p member [getfield $m " " 1]
log local0. "[virtual name] 3b. found a match - previous visit for [IP::client_addr] to cluster [table lookup -subtable [IP::client_addr] "cluster"] and pool member $m in cluster [getfield [class lookup [getfield $m " " 1] cluster_list] " " 1]"
return
} else {
log local0. "FAIL: can't match the remembered cluster to an active pool member [getfield [class lookup [getfield $m " " 1] cluster_list] " " 1]:[table lookup -subtable [IP::client_addr] "cluster"]"
}
}
} else {
if {[active_members $p] > "0" } {
pool $p
} else { log local0. "[virtual name] FAIL: there are no active members in pool $p" }
}
}
when LB_SELECTED {
table add -subtable [IP::client_addr] "cluster" [class lookup [LB::server addr] cluster_list]
}