Forum Discussion

Teemu_Kunnari_1's avatar
Teemu_Kunnari_1
Icon for Nimbostratus rankNimbostratus
Jan 19, 2016

Directing traffic to a node based on a specific uri only if the node is up

Hi,

 

A customer is hoping to direct traffic to a /SOMEURI and when request is for that URI traffic should go to a different pool and member than the original ones on the VS. And only to this new node when it is available. If it is not available then to the original pool.

 

I would really appreciate help on the case with an iRule how to check the status of the special node when it is available.

 

Thanks,

 

Teemu

 

4 Replies

  • You could do something like this.

    when HTTP_REQUEST {
    if {[HTTP::uri] starts_with "/someuri" } {
        if { [active_members other_pool] >= 1 } {
            pool other_pool
        } 
    

    } }

    This will check for the existence of a specific URI and if it matches then check that your secondary pool is available, based on health monitors, if it is up then the traffic for this uri will be passed to it. If the pool is down, or the traffic is for other uri's then it will follow the default logic of the VIP

  • Hi, thanks a lot! This gave perspective. But what if I would like to check just one node if it is up and then forward to it ? I think your first reply solves my problem but am just curious.

     

    Thanks,

     

    Teemu

     

  • Hi

    That would be something like...

    when HTTP_REQUEST {
        if {[HTTP::uri] starts_with " /someuri" } {
        if { [LB::status node x.x.x.x] eq "up" } {
            node x.x.x.x
        } 
    

    } }

    ....again, monitors are key to providing the correct status

  • Hi Teemu,

     

    I would like to recommend to not check the available members on each single web request, since this would put some unnecessary overhead to your LTM.

     

    The better solution would be to use the "Priority Group" pool feature. In this case you would use two independent pools pointing to the same set of nodes. The pool which would be used for /someuri would then get additional "Priority Group" pool settings.

     

    Default Pool

     

    • Member1 = Prio 0

       

    • Member2 = Prio 0

       

    • Member3 = Prio 0

       

    • Member4 = Prio 0

       

    • Member5 = Prio 0 (adding this member is optional)

       

    /someuri Pool

     

    • Member1 = Prio 0

       

    • Member2 = Prio 0

       

    • Member3 = Prio 0

       

    • Member4 = Prio 0

       

    • Member5 = Prio 1

       

    Now your iRule would just need to switch between the different pools based on the given URI, but without checking the availability at all...

     

    For further Priority Groups information: https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm-concepts-11-1-0/ltm_pools.html1216212

     

    Cheers, Kai