Forum Discussion

ajay1986's avatar
ajay1986
Icon for Nimbostratus rankNimbostratus
Aug 14, 2024

Load balancing between node pools

I have 2 nodes configured under pool , with least connection , the requirement is to send traffic for one of the pool members and after 3 hour stop sending traffic  to the first one and switch to the second pool member. Load balance/rotate every 3 hour between both pool members.

Looking for any automation or script to implement this

  • Hi ajay1986 ,

    i assume that you refer to a BIG-IP platform, correct ?

    you mention script or automation as an option, so i assume that having an iRule will not be okay to cover your need.

     

    I would recommend creating 2 pools with different weight:

    pool 1 - member A prio 100, member B prio 50

    pool 2 - member A prio 50, member B prio 100

     

    with the automation, you switch from one pool to the other every 3 hours (it can be an iCall running locally on the BIG-IP).

     

    In that case, if one of your pool member is failing (server down, upgrade, ...) you still work on the remaining pool.

     

    If the idea of running an iCall locally seems ok, let me know, i can send you an example. If you want something external (using API calls, ANSIBLE, Terraform, ...) let me know.

    This can be achieved with 1 pool and changing the pool members prio from automation too.

     

    regards

     

     

  • Thanks for the reply Philippe , it would be great if you can help with ansible script.

     

    • Philippe_CLOUP's avatar
      Philippe_CLOUP
      Icon for Employee rankEmployee

      Hi ajay1986, here after an example of Ansible Playbook that can be used to do the equivalent config change (look specially at the "priority group" values in the items list of pool members

       

      ---
      - name: Create a VIP, pool and pool members
        hosts: all
        connection: local
      
        vars:
            provider:
               password: "MyPassword"
               server: 12.34.45.56
               user: admin
               validate_certs: no
               server_port: 443
      
        tasks:
           - name: Create a pool
             bigip_pool:
               provider: "{{ provider }}"
               lb_method: ratio-member
               name: web
               slow_ramp_time: 120
               priority_group_activation: 1
             delegate_to: localhost
      
           - name: Add members to pool
             bigip_pool_member:
               provider: "{{ provider }}"
               description: "webserver {{ item.name }}"
               host: "{{ item.host }}"
               name: "{{ item.name }}"
               priority_group: "{{ item.priority_group }}"
               pool: web
               port: 80
             with_items:
               - host: 10.10.10.10
                 name: web01
                 priority_group: 10
               - host: 10.10.10.20
                 name: web02
                 priority_group: 1
             delegate_to: localhost