Forum Discussion

David_21149's avatar
David_21149
Icon for Nimbostratus rankNimbostratus
Apr 20, 2010

Getting the configured members of pool in iRule

The Specific Problem:

 

I can't find a way to get the configured members of a pool as a list (member1, member2...) or as a test (is this ip:port in this pool?). I seem to only be able to do the following:

 

- get the active members as a list, or

 

- test the status of a member in a pool, but where "down" can either mean "failed monitor" or "not in the pool at all"

 

 

We are running 9.4.5

 

 

Background:

 

As part of a search sharding scheme, we are segregating search by a parameter in the URI and sending queries to different pools. This works fine. Our second step is to relieve the search servers from indexing the content they won't have to field queries for. Our approach is to have the search servers ask the very same vserver that is actually loadbalancing the search traffic to see if they are responsible for a certain set of searches. It is important to us to do this so that there is one and only one implementation of the sharding scheme, and therefore things will never get out of sync. In the iRule, we watch for a parameter called "cust_in_my_pool=ask" and then we form a response of YES/NO instead of passing the search onto the search servers.

 

 

More on the Problem:

 

We have this logic working fine -- kind of. We actually cannot see the configured members of the pools. We can only see the active members. Or, using LB::status, we can test if a member is "up" or "session_disabled". The problem with this approach is that a member being down by monitor yields "down," and a member not being in the pool at all also yields "down." So our server must be passing its health check for our logic to work, and this is not good b/c a fresh server w/ no indexes or a broken server that we want to fix will not pass its healthcheck and therefore won't be able to learn what indexes it needs to become a healthy happy search server.

 

 

Thanks for reading,

 

 

Dave

 

3 Replies

  • Hi Dave,

     

     

    As you've found, there isn't an iRule command that will return a list of all current members of a pool, regardless of state. You could use a shell script called from cron which populates a datagroup with all of the pool members and then reference that from an iRule.

     

     

    Here is a related post for this:

     

     

    http://devcentral.f5.com/Default.aspx?tabid=53&aft=61613

     

     

    If you think it would be useful to have an iRule command which returns all pool members, you could open a request for enhancement case with F5 Support. It seems like it would be useful to have such a command for this scenario as well as answering questions like 'what percentage of servers in a pool are up?'.

     

     

    Aaron
  • Thanks Aaron.

     

     

    Yeah, I will request the following:

     

    - a "members" statement that works like "active_members"

     

    - that LB::status returns something other than "down" when the ip:port is not actually a member. Maybe "error" or "nonmember" or just ""? I suppose that there would be people out there depending on "down" for a nonmember, so perhaps that can't be done.

     

     

    I see the cron approach (the contest winning status vserver), though I would hate to do anything that would live outside of a configuration sync. We may want to have the search servers query the LB via iControl and find out what pools they are members of that way. Then the iRule can return the pool name instead of "YES"/"NO" and if the name is one of the pools the server is a member of, then that's "YES".

     

     

    Would appreciate any other ideas people think of.

     

     

    Dave
  • From my SE, Doug: "members" command is in v10: http://devcentral.f5.com/wiki/default.aspx/iRules/members.html