I basically have 3 SQL servers and a group of 6 web servers.
SQL Servers
SQL-Live
SQL-UAT
SQL-Wip
Web Servers
UAT
Wip
web1
web2
web3
web4
All web servers are in a pool
I have set them up as nodes on my F5 and I have 1 dns entry set up for sql dns entries which is sql-web.domain.com
what I want to do is be able to re-direct traffic to a specific sql server depending on which web server the SQL request comes from.
So in the code all i want to have is sql-web.domain.com and if this code is on the UAT web server i want the F5 to be able to re-direct this automatically to the UAT SQL server.
the web requests for my wip and uat servers dont go through the f5 but the live web servers are all set up on the F5 with sites as virtual servers using a the web pool of 4 live servers.
Interesting concept… Not sure I like it (Sorry. I shudder at the fact that configs and target IP address are the same between test/dev and production), however the iRule looks fine and should accomplish what you require…
But what do you mean ‘direct traffic base on the node’? In the CLIENT_ACCEPTED event you don’t have access to a lot more other than the clients IP address to determine which webserver the traffic is coming from.
I assume I dont need to have the nodes set up for my wip and uat servers instead I just need to create two virtual servers and assign the irule to that?
OK so i’ve created a virtual server called Wip and assigned it a different IP
I’ve added the wip server ip to the WiP_Servers address list and how would I modify this rule so that any SQL traffic from the wip server will be re-directed to the SQL-WIP pool and any other requests will just pass traffic normally?
when CLIENT_ACCEPTED {
if { [matchclass [IP::remote_addr] equals $::WiP_Servers] } {
pool SQL-WiP
} else {
}
}
Although at the moment when i access a site from a certain server its only seems to re-direct the SQL traffic and connect if I add a host entry on that particular web server for sql-web.domain.com.
do i need to set the virtual server type to forwarding IP by any chance?