Forum Discussion

Scott_82779's avatar
Scott_82779
Icon for Nimbostratus rankNimbostratus
Jul 29, 2009

F5 Custom Monitor with Oracle Data Guard

I am wanting to use an F5 BigIP device to perform load balancing across two physical nodes for our Java-based application server which is running in active/active. The backend database is Oracle 10gR2 configured with a physical standby using Data Guard (active/passive). We have a VIP currently defined to perform load balancing across the two app servers. The problem I am having is on the database side. I need further direction/examples on how to write and implement a custom monitor that will connect to the Oracle database and execute a SQL query to determine on which physical node the primary database is running. There is an Oracle table/view which contains the role (primary or standby) of the database. The BigIP device always needs to point the VIP for the database to the node which has the primary database. The other node will contain the standby database. We are using some older BigIP devices running kernel 4.6.4 Build 8. The model is bip041295s. I realize that we may need to upgrade our software and/or model in order to achieve the desired objective. Of course, if there is an easier way to do this, I would like to know.
  • Chris_Akker_129's avatar
    Chris_Akker_129
    Historic F5 Account
    Hi Scott, this can be done with Big-IP, but I'm pretty sure you will need Version9 or 10 software.

     

     

    If I understand what you want to do here, you want only the db server that is in the Primary Data Guard role to take connections, and keep the Standby server in the pool, but not taking connections. You could do this by writing a custome database monitor, and sending a SQL query to each server, asking each for it's current role. If the answer to the query is "primary", that server would be marked up, and Big-IP would send connections to it. The other server, the query response would be "standby" ( therefore, not Primary ), and the F5 would think the server is down, and not send any connections to it. When the roles are reversed, the response would be reversed, so new connections would then go to the former standby server. You would want to match the monitor interval and timeouts to the speed at which your servers are able to facilitate a role reversal. To determine the Data Guard Role, the sql query in the db monitor could query the database_role column from v$database view. For more details, see Oracle docs here:

     

     

    http://download.oracle.com/docs/cd/B13789_01/server.101/b10823/role_management.htm

     

     

    https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm_configuration_guide_10_0_0/ltm_monitors.html1210419

     

     

    -Chris.