Matt_Breedlove_
Apr 24, 2007Nimbostratus
TCP Payload String Swap for Oracle HA
Hi,
I would like to use an iRule on a VIP that heads 4 Oracle DB RAC servers. Each server helps serve a single DB on SAN attached storage. However, Oracle requires that each rac host have a unique SID.
So host db01 uses SID "acmesid1"
So host db02 uses SID "acmesid2"
So host db03 uses SID "acmesid3"
So host db04 uses SID "acmesid4"
The application servers which use the database hosted by these 4 RAC servers can only have a single SID configured.
I would like the Application server to be configured with "acmesid_vip" and when when the application server hits the BigIP on port 1521 with this SID in tow the BigIP will open the TCP Payload and swap this incoming SID "acmesid_vip" with "acmesid1" or "acmesid2" or "acmesid3" or "acmesid4" based on which DB server the BigIP is planning on forwarding the request to, respectivley.
So in short is there a way to do a regular expression on the TCP payload of all incoming packets s/acmesid_vip/acmesid1/ in the case of going to the first DB server?
I have seen the TCP::payload function and this is what I have so far which I am sure is horribly busted as it uses a mix of pseudo code to get my goal across as I am no irules guru
What do you think?
set payload [TCP::payload]
if { destDBHost=db01 } {
set END_SID "acmesid1"
regsub -all "(acmesid_vip)" $payload "\\1\\2$END_SID" payload
TCP::payload replace 0 [TCP::payload length] $payload
}
if { destDBHost=db02 } {
set END_SID "acmesid2"
regsub -all "(acmesid_vip)" $payload "\\1\\2$END_SID" payload
TCP::payload replace 0 [TCP::payload length] $payload
}
if { destDBHost=db03 } {
set END_SID "acmesid3"
regsub -all "(acmesid_vip)" $payload "\\1\\2$END_SID" payload
TCP::payload replace 0 [TCP::payload length] $payload
}
if { destDBHost=db04 } {
set END_SID "acmesid3"
regsub -all "(acmesid_vip)" $payload "\\1\\2$END_SID" payload
TCP::payload replace 0 [TCP::payload length] $payload
}