Forum Discussion
Need help with iRule using custom persistence table based on GUID
I have an iRule which is mostly functional however, the persistence does not seem to be working as needed. The collection of the GUID data is working as needed. My logs show that the correct node (node1) is selected but a packet capture reveals that node2 is in fact chosen instead. I have two questions. 1. Is there some way to view a custom persistence table? 2. Does the "when LB_SELECTED" look right?
2 Replies
- Sean_McGirk_859
Nimbostratus
Here is the iRule
when RULE_INIT { set static::persist_duration 300 set static::debug_TCPPersist 1 ^^^^ set to zero to stop logging }
when CLIENT_ACCEPTED { TCP::collect 200 }
when CLIENT_DATA { set sTCP_Data [TCP::payload 200] set sGUID [string trim [getfield [getfield $sTCP_Data ":" 2] "," 1] " \""] set sNodeIP [table lookup -subtable TCP_Persist $sGUID] if { $sNodeIP eq "" } { if { $static::debug_TCPPersist} { log local0. "Moving on to load balance decision for guid $sGUID" } } else { if { $static::debug_TCPPersist} { log local0. "We found a previous decision for $sGUID to node $sNodeIP" } } TCP::release
}
when LB_SELECTED { if { $sNodeIP eq "" } { table set -subtable TCP_Persist $sGUID [LB::server addr] $static::persist_duration if { $static::debug_TCPPersist} { log local0. "Set persist for $sGUID to [LB::server addr]" } } else { node $sNodeIP if { $static::debug_TCPPersist } { log local0. "Selected $sNodeIP" } } }
It works for me when replacing
withnode $sNodeIP
.LB::reselect node $sNodeIP
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
