Forum Discussion
sandiksk_35282
Altostratus
Sep 24, 2015need help with an irule
I have 2 app serves i.e need to talk to the database VIP,load balancing 2 database servers.
How can I create an irule so that
app server 1 --- always talk to database server 1
app server 2--...
Hannes_Rapp
Nimbostratus
Sep 24, 2015Given the requirement to cover for High Availability despite strict IP-based routings, you're better off using an iRule.
I believe the code below covers your requirements.
Please give it a try and let me know if you have any questions. Replace the values of IP addresses, port numbers and the don't forget to modify the pool name "DB_servers_pool".
when CLIENT_ACCEPTED {
if { [active_members DB_servers_pool] < 2}{
Bypass the execution of strict IP-based routing. Allows F5 to select any node that is available
return
} elseif { [IP::client_addr] == "1.1.1.1" }{
Explicitly forward App Server 1 traffic to a specific database pool member via TCP port 3306
pool DB_servers_pool member 10.10.10.1 3306
} elseif { [IP::client_addr] == "1.1.1.2" }{
Explicitly forward App Server 2 traffic to a specific database pool member via TCP port 3306
pool DB_servers_pool member 10.10.10.2 3306
}
}Regards,
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects