Forum Discussion

Infinity05_1794's avatar
Infinity05_1794
Icon for Nimbostratus rankNimbostratus
Dec 02, 2011

Load balancing with applications that don't like it

We have an application that occasionally makes a call to a web server through F5. The problem is when we disable a VS for patching / code update, application doesn't handle the disabling of the server well and will throw an error unless the application is restarted.

 

 

Was told that an iRule might be my best bet so I'm trying to come up with an iRule that checks to see if the server is disabled and if so, closes the connection back to the application. Hoping this will create a more seamless failover to the secondary VS. Is there an iRule already created that does this?

 

 

 

(we don't have persistance turned on, the second VS is at our DR site. We have 2 GTMs and 4 LTMs (2 redundant pairs, 1 at each datacenter).

 

 

 

Thanks in advance for the help.

 

2 Replies

  • can you try this?

    [root@ve1023:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b pool foo list
    pool foo {
       monitor all http
       members 200.200.200.101:80 {}
    }
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when CLIENT_ACCEPTED {
            log local0. "[IP::client_addr]:[TCP::client_port] > [IP::local_addr]:[TCP::local_port]"
            log local0. "\[active_members [LB::server pool]\]: [active_members [LB::server pool]]"
    
            if {[active_members [LB::server pool]] < 1} {
                    TCP::close
            }
    }
    }
    
    [root@ve1023:Active] config  b pool foo|grep -i pool\ member
    +-> POOL MEMBER foo/200.200.200.101:80   inactive,down
    
    [root@centos251 ~] curl -I http://172.28.19.79
    curl: (52) Empty reply from server
    
    [root@ve1023:Active] config  tail -f /var/log/ltm
    Dec  2 06:12:26 local/tmm notice tmm[23027]: 013e0001:5: Tcpdump starting bcast on :::0 from 127.1.1.1:55463
    Dec  2 06:12:29 local/tmm info tmm[23027]: Rule myrule : 172.28.19.251:38310 > 172.28.19.79:80
    Dec  2 06:12:29 local/tmm info tmm[23027]: Rule myrule : [active_members foo]: 0
    
    [root@ve1023:Active] config  tcpdump -nni 0.0 port 80 and not host 200.200.200.101
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on 0.0, link-type EN10MB (Ethernet), capture size 108 bytes
    06:12:29.387374 IP 172.28.19.251.38310 > 172.28.19.79.80: S 4233237129:4233237129(0) win 5840 
    06:12:29.387417 IP 172.28.19.79.80 > 172.28.19.251.38310: S 506930985:506930985(0) ack 4233237130 win 4380 
    06:12:29.388397 IP 172.28.19.251.38310 > 172.28.19.79.80: . ack 1 win 46 
    06:12:29.388471 IP 172.28.19.79.80 > 172.28.19.251.38310: F 1:1(0) ack 1 win 4380 
    06:12:29.388475 IP 172.28.19.251.38310 > 172.28.19.79.80: P 1:156(155) ack 1 win 46 
    06:12:29.389177 IP 172.28.19.251.38310 > 172.28.19.79.80: F 156:156(0) ack 2 win 46 
    06:12:29.389189 IP 172.28.19.79.80 > 172.28.19.251.38310: . ack 157 win 4535