Forum Discussion

Ross_Fitheridge's avatar
Ross_Fitheridge
Icon for Nimbostratus rankNimbostratus
Nov 12, 2007

list and RULE_INIT

We have multiple servers with the same content. Each server has its own certificate assigned.

 

What I am try to achieve is a round robin load balance of redirects to these HTTPS servers.

 

One of the problems is that there is no checking that the servers are available, and I need to modify the list in the event of failure or maintenance.

 

 

The code works with the exception of when I remove a host from the list, if I save the iRule with a new name and apply that to the virtual server it works again ok.

 

 

What appears to happen is that the host entry in the list is still there, even though it is not in the iRule if I just update the iRule, using the iRule editor to modify the iRule. I think the RULE_INIT is not resetting my list, is there a reset I need to be doing?

 

Rule attached.

 

 

V9.1.2

 

 

RossF
  • Hi Ross,

     

     

    You can use LB::status (Click here) to check the status of a pool member or node. Per the wiki page, this command was added in 9.1.2 HF4. You can download 9.1.3 (which I think has the command) or HF8 from downloads.f5.com.

     

     

    Do you have multiple rules which contain the global variable, ::HOSTNAME1? It's possible that one rule is conflicting with the other. You can add a log statement for debug purposes to check the value of the list in the RULE_INIT event and the HTTP request event:

     

     

    log local0. "class value: $::HOSTNAME1"

     

     

    The output should be something like:

     

     

    rule : class value: {host1} {host2} {host3}

     

     

    Aaron
  • Hi Aaron,

     

    Yes I could use the LB::status but how to take servers in and out of the list, seems a little beyond me; unfortunately it has to be a redirect.

     

     

    HOSTNAME1 is only used by this rule.

     

     

    Well I have tested again and it seems fine, when I was testing I was on V9.1.1, (its taken me a little time to get round to this), and now I am at V9.1.2 HF8, perhaps its fixed the issue.

     

     

    Any guidance on how to use LB::status to modify the servers in the list appreciated.

     

     

    RossF
  • Sorry, I thought you wanted to check the status of a member in a pool. Are you wanting to just remove a host from the list of hostnames when it's out of service? If so, it would be better to define the hosts in separate datagroup and then update the datagroup when necessary. The advantage to this is that you don't need to reload the rule to initialize the change to the hosts list. You could still reference the datagroup using the list commands (or the findclass command). If you wanted to stay with the list in the RULE_INIT event, you should be able to just modify the list to add/remove hosts.

     

     

    If I'm misunderstanding what you're trying to do, can you clarify more?

     

     

    Thanks,

     

    Aaron
  • Hi Aaron,

     

    yes I could put in a datagroup, then the question would be how can I add and remove from datagroup AUTOMATICALY as the status of servers change?

     

    Using a datagroup would be smarter - not needing to change the iRule; but the advantage of having the whole list of servers in an iRule does mean in a single window I can see what is in service and what is out of service, wheres through the GUI I am only going to see what is in the datagropu (in service), and have to refer to other documentation for the whole list of server names, small point. It could be argued that it is more dangerous to modify the iRule, I see both views.

     

    RossF
  • Ross,

     

     

    In theory, as long as there is a monitor on the IP:port you eventually want to load balance to, you could check the status of the node using LB::status and only send requests to a destination that is marked up. This is the default behavior for standard load balancing. I'm trying to figure out if this will work for your scenario.

     

     

    What is the relationship between the hosts in the list and the servers you want to mark up/down? When you issue a redirect to one of the hosts, like mars.rent-at-acme.com, is that subsequent request going to the virtual server you're applying this rule to, or another virtual server on the BIG-IP? Is it there a default pool on that virtual server that the request is load balanced to? Is there a one to one mapping between the hosts in the list and an IP address/port that the BIG-IP is load balancing to?

     

     

    Aaron
  • Hi Ross,

    That's making more sense then. So if you want to maintain your own mapping of the hostnames and their corresponding pools, you could do that in the datagroup (or internal list). Before issuing the redirect, you could look up the host's corresponding pool and verify that the pool has one or more active members. If that test fails, you could try the next host in the list.

    The list would be something like this:

    
    list {host1 pool1} {host2 pool2} {host3 pool3}

    You could then use a foreach loop to go through each list entry and check if the pool is up.

    Alternately, you could write a rule for the individual virtual servers that redirects if there aren't any members marked up in the pool. The fallback option on the HTTP profile provides this kind of functionality. Doing it this way would eliminate the need to map the hosts to a corresponding pool and check the state of the pools beforehand.

    If you choose the first option and get stuck, let me know.

    Aaron
  • Hi Aaron,

     

    makes sense. First option looks better, but second simpler, I'll mull it over.

     

    Thanks.

     

    RossF