Forum Discussion

Klaus_Gerthein1's avatar
Klaus_Gerthein1
Icon for Nimbostratus rankNimbostratus
Aug 31, 2012

Getting uie persistence info from persistence table

Hello,

 

 

I am load balancing a mysql master master cluster via persist uie to ge a single node persistence.

 

I used this documentation: https://devcentral.f5.com/wiki/irules.singlenodepersistence.ashx

 

This is working fine.

 

 

Now I want to do the database backup on the pool member which is not used by this persistence via a seperate virtual server.

 

----

 

 

Write Virtual DB Server:

 

Virtual Server IP 10.6.1.2:3306

 

pool db_write members 10.4.9.9:3306 and 10.4.9.8:3306

 

 

----

 

 

Back Virtual DB Server:

 

Virtual Server IP 10.6.1.2:3307

 

pool db_backup members 10.4.9.9:3306 and 10.4.9.8:3306

 

 

----

 

On the "Backup Virtual DB Server" I want to run an irule which checks

 

which Pool Member from "Write Virtual DB Server" is currently the persist pool member.

 

 

Via command line I got this information:

 

show ltm persistence persist-records pool db_write

 

Sys::Persistent Connections

 

universal 10.6.1.2:3306 10.4.9.9:3306 1

 

universal 10.6.1.2:3306 10.4.9.9:3306 3

 

 

But via irule I got no information:

 

when CLIENT_ACCEPTED {

 

set PersistTo [persist lookup uie { 1 pool db_write } ]

 

log local0. "Current Persist Master is $PersistTo"

 

}

 

 

or

 

 

when CLIENT_ACCEPTED {

 

set PersistTo [list [persist lookup uie 1]]

 

log local0. "Current Persist Master is $PersistTo"

 

}

 

 

I always got an emtpy log entry

 

: Current Persist Master is

 

: Current Persist Master is {}

 

 

----

 

 

Kind regards

 

Klaus

 

3 Replies

  • can you try "1 any virtual"?

    e.g.

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
    }
    [root@ve10:Active] config  b pool foo list
    pool foo {
       members {
          200.200.200.101:80 {}
          200.200.200.102:80 {}
       }
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when CLIENT_ACCEPTED {
            persist uie 1
    }
    }
    
    [root@ve10:Active] config  b rule mybackup list
    rule mybackup {
       when CLIENT_ACCEPTED {
       set p [persist lookup uie {1 any virtual}]
       if {[scan $p "[LB::server pool] %s %d" ip port] == 2} {
          foreach m [active_members -list [LB::server pool]] {
             if {$m ne "$ip $port"} {
                pool [LB::server pool] member $m
                break
             }
          }
       } else {
          reject
       }
    }
    when SERVER_CONNECTED {
            log local0. "[IP::remote_addr]:[TCP::remote_port]"
    }
    }
    
    [root@ve10:Active] config  b persist
    PERSISTENT CONNECTIONS
        Type           Virtual                Node
        universal      172.28.19.79:80   200.200.200.101:80
    
    [root@ve10:Active] config  cat /var/log/ltm
    Sep  3 06:14:30 local/tmm info tmm[4925]: Rule mybackup : 200.200.200.102:80
    
    
  • Hello,

     

     

    I will try to run the irule in version 11.2 with routing domains.

     

    Thank you for your feedback.

     

     

    Kind regards

     

    Klaus

     

     

  • Hello ,

     

     

    I have tested the irule and it is working with version 11.2.1 and routing domains.

     

     

    Kind regards

     

    Klaus