Forum Discussion

_Dmi_'s avatar
_Dmi_
Icon for Altostratus rankAltostratus
Nov 17, 2023

pool selection

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. 

 

 

  • 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

    • _Dmi_'s avatar
      _Dmi_
      Icon for Altostratus rankAltostratus

      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.