For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Kirit_Patel_521's avatar
Kirit_Patel_521
Icon for Nimbostratus rankNimbostratus
Jul 18, 2015

health monitor question

I have a requirement from a customer where there are 2 members in a pool

 

172.16.197.204 port 22750 and 172.16.197.204 port 22760 .

 

First requirement is if URL is /solr/SPRUAT_Master then do Active / Passive load balancing between below nodes and traffic should only go to 172.16.197.204 port 22750 and I achieved that using priority group and a monitor as below

 

Send string GET /solr/SPRUAT_Master/admin/ping HTTP/1.0\r\n\r\n receive string OK

 

But in addition to that for same members as above they want

 

if URL is /solr/SPRUAT_Slave then do round robin load balancing between samew nodes as above.

 

How can i achive that using irule or something to make this work.

 

9 Replies

  • giltjr's avatar
    giltjr
    Icon for Nimbostratus rankNimbostratus

    What I would do is define a new pool with both nodes and no priority group.

    Then using an iRule examine the URI and select the appropriate pool.

    when HTTP_REQUEST {
        switch -glob [HTTP::uri] {
            "/solr/SPRUAT_Slave*" {pool NewPool}
            default {pool ExstingPool}
        }
    }
    
  • thanks . can't u define two monitors and use it in irule?

     

    monitor 1

     

    GET /solr/SPRUAT_Master/admin/ping HTTP/1.0\r\n\r\n

     

    with receive string OK monitor 2

     

    GET /solr/SPRUAT_Slave/admin/ping HTTP/1.0\r\n\r\n

     

    with receive string ok

     

  • giltjr's avatar
    giltjr
    Icon for Nimbostratus rankNimbostratus

    Any special reason you don't want to define a 2nd pool?

     

    That I am aware of there is no way to "call" a monitor from a iRule and check the results.

     

  • no - no special reason have defined the irule as

     

    when HTTP_REQUEST { switch -glob [HTTP::uri] { "/solr/SPRUAT_Slave*" {pool mhf_pool_172.16.250.72-slave} default {pool mhf_pool_172.16.250.72-80} } }

     

  • no - no special reason have defined the irule as

     

    when HTTP_REQUEST { switch -glob [HTTP::uri] { "/solr/SPRUAT_Slave*" {pool mhf_pool_172.16.250.72-slave} default {pool mhf_pool_172.16.250.72-80} } }

     

  • Ok its not working traffic is not going to pool pool mhf_pool_172.16.250.72-slave when i do the following.

    Note I have a monitor setup for as sol_uat_slave where send string is

    GET /solr/SPRUAT_Slave/admin/ping HTTP/1.0\r\n\r\n

    and recieve string is OK

    ^C$ telnet 172.16.250.72 80 Trying 172.16.250.72... Connected to 172.16.250.72. Escape character is '^]'. GET /solr/SPRUAT_Slave/admin/ping HTTP/1.0\r\n\r\n

    HTTP/1.1 200 OK Connection: close Date: Sat, 18 Jul 2015 21:31:34 GMT Content-Type: application/xml; charset=UTF-8

    03allsolrpingqueryfalseOK Connection to 172.16.250.72 closed by foreign host

    Here is my full config

    ltm pool /Finance/mhf_pool_172.16.250.72-80 { members { /Finance/172.16.197.204:22750 { address 172.16.197.204 priority-group 1 } /Finance/172.16.197.204:22760 { address 172.16.197.204 } } min-active-members 1 monitor /Finance/sol_monitor

    sol_monitor is 
    
    ltm monitor http /Finance/sol_monitor {
    defaults-from /Common/http
    destination *:*
    interval 5
    recv OK
    send "GET /solr/SPRUAT_Master/admin/ping HTTP/1.0\\r\\n\\r\\n"
    time-until-up 0
    timeout 16
    

    ltm pool /Finance/mhf_pool_172.16.250.72-slave { members { /Finance/172.16.197.204:22750 { address 172.16.197.204 } /Finance/172.16.197.204:22760 { address 172.16.197.204 } } monitor /Common/sol_uat_slave

    my irule is
    
     ltm rule /Finance/sol_irule {
    when HTTP_REQUEST {
    switch -glob [HTTP::uri] {
        "/solr/SPRUAT_Slave*" {pool mhf_pool_172.16.250.72-slave}
        default {pool mhf_pool_172.16.250.72-80}
    }
    

    } }

  • giltjr's avatar
    giltjr
    Icon for Nimbostratus rankNimbostratus

    Does the pool members for mhf_pool_172.16.250.72-slave show as up?

    You may want to add:

    log local0. "The URI passed was [HTTP::uri]" 
    

    to the iRule just before the switch. That way you can verify that the URI is what you expect.

  • OK fixed the irule as

    when HTTP_REQUEST { log local0. [HTTP::uri] if {[string tolower [HTTP::uri]] starts_with "/solr/spruat_slave" } { log local0. "matched [HTTP::uri]" pool mhf_pool_172.16.250.72-slave }

       }
    

    But now I am trying add a OR statement and getting syntax error

    01070151:3: Rule [/Finance/test_sol] error: /Finance/test_sol:3: error: [parse error: PARSE syntax 190 {syntax error in expression "([string tolower [HTTP::uri]] starts_with "/solr/spruat_slav...": unexpected operator &}][{([string tolower [HTTP::uri]] starts_with "/solr/spruat_slave") || ([string tolower [HTTP::uri]] starts_with “/sol”) }]

    when HTTP_REQUEST {

    log local0. { "http::uri" [HTTP::uri] } if {([string tolower [HTTP::uri]] starts_with "/solr/spruat_slave") || ([string tolower [HTTP::uri]] starts_with “/sol”) } { log local0. "matched [HTTP::uri]" pool mhf_pool_172.16.250.72-slave

    }
       }
    
  • giltjr's avatar
    giltjr
    Icon for Nimbostratus rankNimbostratus

    Instead of using the double vertical bars (||) try using the word "or".