Forum Discussion

Keith_Richards_'s avatar
Keith_Richards_
Icon for Nimbostratus rankNimbostratus
Mar 16, 2005

iRule for splitting SQL Write and Read

I have a requirement to demonstrate using LTM to split SQL Read operations and write operations to two separate pools of SQL database servers. Has anyone tried to do this or could the recommend a starting point?

 

 

Thanks, Keith

4 Replies

  • Hello!

     

    Has anyone experiences with BigIP and MySql?

     

    Are there existing iRules for splitting SQL Read and Write request onto a MySQL Master Slave Replication?

     

     

    I know, there is a way to do it with Zeus, but I'd like to do it with f5:

     

    http://knowledgehub.zeus.com/articles/2008/07/07/building_a_mysql_load_balancing_proxy

     

     

    Regards,

     

    Mario
  • Hi Mario,

     

     

    That example from Zeus is novel and shows how you might be able to spoof the server handshake, but still only selects the read or write pool based on the username--not the SQL statement.

     

     

    Aaron
  • One thing that makes this a hard issue is that your parser in the iRule needs to understand something of the SQL statement. For example, if you simply send the SELECTS to one pool and the UPDATE, INSERT and DELETE to another pool, you also have to handle UPDATE . Not a very common construct, but still to be handled. I hate to say it but setting up an MYSQL cluster might be a more robust solution.

     

     

    Tom Schaefer SET column=something where id in (SELECT id from
  • Hi Aaron, hi Tom,

     

     

    first of all: thanks for your response. Is there a way to split the MySQL requests based on the SQL statement?

     

    MySql state in their documentation as follows abot scaling: http://dev.mysql.com/doc/refman/5.0/en/images/scaleout.png

     

    They use a loadbalancer to distribute traffic between serveral webserver. Each webserver is bound on one Slave-MySql database.

     

     

    But I would like to scale at a different place. I'd like to configure only one database ip and one port as a loadbalancer vip and distribute the traffic automatically.

     

    I'd like to do it that way is: it works with absolutely every application and doesn't require any code changes or more complex deloyments.

     

     

    Any ideas?

     

     

    Kind regards,

     

    Mario

     

     

    P.S.: I'm aware of your point, Tom. Nonetheless, I would simply handle this as an UPDATE.