Forum Discussion

Laehr_53239's avatar
Laehr_53239
Icon for Nimbostratus rankNimbostratus
Feb 14, 2011

MYSQL load balancing using LTM

Hello All

 

 

Hope everyone is doing fine.

 

 

I need to configure a Mysql Load balancer using the F5's LTM. Appreciate any help on getting to the solution, a step by step documentation would be great.

 

 

Thanks and Regards

 

Laehr

 

  • Hi Laehr,

     

     

    You can configure LTM to load balance SQL traffic. But LTM can't natively parse SQL reads and writes to implement more advanced load balancing scenarios like 'send all reads to one pool of SQL servers and all writes to another pool'.

     

     

    What are you trying to accomplish by load balancing the traffic?

     

     

    Which LTM version are you running?

     

     

    Aaron
  • Thank You Aaron.

     

     

    I have a mysql cluster to be used in production and I wanted to achieve High Availability using LTM v 10.2

     

     

    I am fine if it doesn't differentiate read/write pools, simple load balancing is enough for now.

     

     

    Thanks and Regards

     

    Laehr
  • I think the most common and useful scenario LTM can support for databases is to have two members in a pool and use UIE persistence to ensure requests go to the currently active unit until it fails. If the first pool member is marked down, the second pool member would receive all connections even after the first member comes back up. Here is the iRule for this:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/SingleNodePersistence.html

     

     

    Does this look like a good solution for your scenario?

     

     

    Aaron
  • Hello Aaron

     

     

    Thank you for sharing the informative link on persistence.

     

     

    I have 4 mysql nodes to load balance, I need to load balance it may be using round robin or least weighted method.

     

     

    I am actually stuck up at the very first step of setting up monitoring for the mysql nodes for the health check. Is there are white paper, case study or documentation that you can refer to me so that I can set up the LTM as a LB for the Mysql nodes.

     

     

    Thanks and Regards

     

    Laehr

     

     

  • Laehr,

     

     

    Have you seen the blog post I made last year on monitoring MySQL and PostgreSQL?

     

     

     

    - http://devcentral.f5.com/weblogs/rcorder/archive/2010/05/25/monitoring-open-source-databases-with-big-ip.aspx

     

     

     

  • Can you share you details to configure LTM to load balance MySQL traffic.

     

     

    I want to implement for two mysql nodes....

     

     

     

    can you provide the steps
  • Ron_Carovano_75's avatar
    Ron_Carovano_75
    Historic F5 Account
    jksingh,

     

     

    Keep watching this space--we expect to publish something before the end of the calendar year.

     

     

    Ron
  • Ron_Carovano_75's avatar
    Ron_Carovano_75
    Historic F5 Account
    Great news! The MySQL proxy iRule and iApp are now available!

     

     

    iRule: http://devcentral.f5.com/wiki/iRules.MySQL-Proxy.ashx

     

     

    iApp: http://devcentral.f5.com/wiki/iApp.MySQL-Proxy-iApp.ashx

     

     

    iRule to implement Layer 7 full proxy for MySQL servers. This proxy alleviates the need for a developer to modify his/her application to use multiple database handles when scaling from a standalone MySQL server to a Master/Slave cluster. Read-only queries are sent to the slave pool while all others are sent to the master pool.

     

     

    Many thanks to rcorder for the post!

     

     

    Ron
    • Jer-O's avatar
      Jer-O
      Icon for Cirrus rankCirrus

      Where is the actual iRule on the page? I'm reviewing content in the iApp, which provides some insight. But I thought there would be sample code on the iRule version page.

       

      Update: Judging from the iApp code, I see that it might be too large to try to include it on the iRule page. I just felt the page was confusing in that there was no sample code.