Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

pool selection

_Dmi_
Nimbostratus
Nimbostratus

Hi, is it poossible to implement irule logic below?

By default traffic select Pool1, but it select Pool2 if online pool members of Pool1 below two. If all pool members became available in Pool1, traffic will continue select Pool2. 

 

 

4 REPLIES 4

Paulius
MVP
MVP

@_Dmi_ You can do this with priority group activation in 1 pool rather than having 2 different pools.

https://my.f5.com/manage/s/article/K13525153

I cant use it. The full scenario is 

By default traffic select Pool1, but it select Pool2 if online pool members of Pool1 below two. If all pool members became available in Pool1, traffic will continue select Pool2. But then online pool members of Pool2 below two, traffic must come back to Pool1.

JoseLabra
Altocumulus
Altocumulus

Hii

You can try this

when HTTP_REQUEST {

set pool_a_members [LB::pool pool_a members]
if { [llength $pool_a_members] > 0 } {
pool pool_a
} else {
pool pool_b
}
}

 

or check this post similar

 

https://community.f5.com/t5/technical-forum/how-to-write-an-irule-to-redirect-traffic-to-different-p...

 

Best Regard

I think the iRule below fill meet your requirements.

when CLIENT_ACCEPTED {
    set pri_pool "/Common/pool_a"
    set sec_pool "/Common/pool_b"

    if {[table lookup active_pool] ne ""} {
        if { [active_members [table lookup active_pool]] >= 2 } {
        }
        elseif { $active_pool eq $pri_pool } {
            table replace active_pool $sec_pool indefinite
        }
        else {
            table replace active_pool $pri_pool indefinite
        }
    }
    else {
        table set active_pool $pri_pool indefinite
    }
    
    pool [table lookup active_pool]
}

 

 

Have fun,

     --Niels