Forum Discussion

Parveez_70209's avatar
Parveez_70209
Icon for Nimbostratus rankNimbostratus
Nov 07, 2013

Need to Replace POOL Selection Using Data-Groups

Hi Team,

Need assistance in replacing Manual Pool selection in Irule by using Data-Groups:

Lets take 3 examples of the Virtual-servers and with Pool-name:

a) apuat.leni2.com-VS-HTTP : pool_apuat_leni2.com_http b) apbuild.leni2.com-VS-HTTP : pool_apbuild.leni2.com_http c) apctdev.leni2.com-VS-HTTP : pool_apctdev.leni2.com_http

In every setup we have the respective HTTP Irules attached mentioned in a), b) and c):

a) apuat.leni2.com-VS-HTTP : pool_apuat_leni2.com_http

when CLIENT_ACCEPTED { set default_pool [LB::server pool] log local0. "Default pool [LB::server pool] set" log local0. "Client IP is [IP::remote_addr]" }

when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri]] log local0. "requested [HTTP::uri]" if {$https_uri equals "/" } { HTTP::redirect "http://www.lenovo.com" pool pool_lenovo.com-http log local0. "redirected from /"

                            return

} elseif { $http_uri starts_with "/iss_static" } {

log local0. "matched /iss_static"

pool pool_confarmsp.leni2.com_http 

log local0. "pool_confarmsp.leni2.com_http defined, [LB::server pool] selected" return

} elseif { $http_uri starts_with "/"} { log local0. "URI starts with /"

   pool pool_apuat_leni2.com_http

log local0. " pool_apuat_leni2.com_http defined, [LB::server pool] selected" return

            }  else {

log local0. "no match for rev. close connection"

pool pool_apuat_leni2.com_http
            }

}

======================= b) apbuild.leni2.com-VS-HTTP : pool_apbuild.leni2.com_http

when CLIENT_ACCEPTED { set default_pool [LB::server pool] log local0. "Default pool [LB::server pool] set" log local0. "Client IP is [IP::remote_addr]" }

when HTTP_REQUEST { set https_uri [string tolower [HTTP::uri]] log local0. "requested [HTTP::uri]" if {$https_uri equals "/" } { HTTP::redirect "https://www.lenovo.com" pool pool_www.lenovo.com-http

log local0. "redirected from /"

                            return

} elseif { $https_uri starts_with "/iss_static" } {

log local0. "matched /iss_static"

pool pool_confarmct.leni2.com_http

log local0. "pool_confarmct.leni2.com_http defined, [LB::server pool] selected" return

            }  else {

log local0. "no match for rev. close connection" pool pool_apbuild.leni2.com_http

            }

}

c) apctdev.leni2.com-VS-HTTP : pool_apctdev.leni2.com_http

when CLIENT_ACCEPTED { set default_pool [LB::server pool] log local0. "Default pool [LB::server pool] set" log local0. "Client IP is [IP::remote_addr]" }

when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri]] log local0. "requested [HTTP::uri]" if {$http_uri equals "/" } { HTTP::redirect "http://www.lenovo.com" pool pool_lenovo.com_http log local0. "redirected from /"

    return

} elseif { $http_uri starts_with "/iss_static" } {

log local0. "matched /iss_static"

pool pool_confarmct.leni2.com_http

log local0. "pool_confarmct.leni2.com_http defined, [LB::server pool] selected" return

} elseif { $http_uri starts_with "/" } { pool pool_apctdev.leni2.com_http return

} }

  1. If you review the HTTP Profile Irules, we have much in common and we have different pools mentioned into the irule with respect to Virtual-server too, so in place of that we wanted to have a class-group/Data-group.

  2. So, when a user hit the Virtual-server, the request will check whether it need the static page mentioned by "/iss_static" or to the dynamic page content mentioned in else statement and than to respective pools, but our requirement is saying not to specify manual pool into the Irule, we need to specify with the Data-group.

  3. We want to keep constant the pool marked against iss_static into the Irule. Only we wanted to add/insert Data-group for the pools mapped against the Else statement( the pool where the traafic will go when it don't match iss_static).

Means for the below part we wanted to insert Data-Group in place of manual pool.

} elseif { $http_uri starts_with "/" } { pool pool_apctdev.leni2.com_http return

  1. And for future if any new request comes,apart from Virtual-server creation, we just attach the irule which contains the Data-group which contains all the pool information into that,and in that Data-group we will just add the new pool, so this is to eliminate maximum of human error and operationally also this will be great.

  2. Can you please assist into this by taking the example of the Three Virtual-Servers:

Please assist . Example:

a) Virtual-server : apuat.leni2.com-VS-HTTP , Pool : pool_apuat_leni2.com_http b) Virtual-server : apbuild.leni2.com-VS-HTTP , Pool : pool_apbuild.leni2.com_http c) Virtual-server : apctdev.leni2.com-VS-HTTP , Pool : pool_apctdev.leni2.com_http

Thanks and Regards Parveez

5 Replies

  • Hi Parveez, Yoour question was a little difficult to read due the formating, but to summarize are you trying to send traffic based on a match up between URI and pool, but the match up using the datagroups. If so then there is a post that talks about it

     

    https://devcentral.f5.com/questions/114-node-pool-select-according-to-domains-list

     

    I hope this helps. -=Bhattman=-

     

  • Hi,

     

    No our requirement is different. Please copy the same in Notepad, you will get detailed part.

     

    Thanks and Regards Parveez

     

  • Can you also reformat your post. I am sure others will also take a look at it and assist.

     

    -=Bhattman=-

     

  • Hi,

    Ok let’s take one existing of one sample Irule extracted from older posts into the same subject:

    when CLIENT_ACCEPTED { set default_pool [LB::server pool] log local0. "Default pool [LB::server pool] set" log local0. "Client IP is [IP::remote_addr]" }

    when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri]] log local0. "requested [HTTP::uri]" if {$https_uri equals "/" } { HTTP::redirect "http://www.lenovo.com" pool pool_lenovo.com-http log local0. "redirected from /"

                                return
    
    } elseif { $http_uri starts_with "/iss_static" } {
    

    log local0. "matched /iss_static"

    pool pool_confarmsp.leni2.com_http 
    

    log local0. "pool_confarmsp.leni2.com_http defined, [LB::server pool] selected" return

    } elseif { $http_uri starts_with "/"} { log local0. "URI starts with /"

       pool pool_apuat_leni2.com_http
    

    log local0. " pool_apuat_leni2.com_http defined, [LB::server pool] selected" return

                }  else {
    

    log local0. "no match for rev. close connection"

    pool pool_apuat_leni2.com_http
                }
    

    }

    So summary:

    1. If we check the HTTP Profile Irules, we have much in common and we have different pools mentioned into the irule w.r.t Virtual-server too, so in place of that we wanted to have a class-group/Data-group.

    2. So, when a user hit the Virtual-server, the request will check whether it need the static page mentioned by "/iss_static" or to the dynamic page content mentioned in elseif statement and then go to respective pools, but our requirement is saying not to specify manual pool into the Irule, we need to specify with the Data-group.

    3. We want to keep constant the pool marked against iss_static into the Irule, only we wanted to keep/add Data-group for the pools mapped against the ElseIf statement( the pool where the traffic will go when it don’t match iss_static).

    } elseif { $http_uri starts_with "/" } { pool pool_apctdev.leni2.com_http return

    1. And for future if any new request comes, apart from Virtual-server creation, we will just attach the irule which contains the Data-group which contains all the pool information into that, and in that Data-group we will just add the new pool, so this is to eliminate maximum of human error and operationally also this will be great.

    Whether this concept work, putting all the Pools in Data-group and by what means we can match or send the entry to the right pool based on the respective Virtual-Server.

    Thanks and Regards Parveez