MySQL Proxy Load balancing and Failover Tutorial

MySQL Proxy is a simple and new program that sits between your client and MySQL server(s) that can monitor, analyze or transform their communication. Its flexibility allows for a wide variety of use cases, including:
a) Load balancing
b) Failover
c) Query analysis
d) Query filtering and modification
e) and many more…

MySQL Proxy tutorial

Oreilly has published a nice tutorial using MySQL proxy application:

MySQL Proxy is a lightweight binary application standing between one or more MySQL clients and a server. The clients connect to the Proxy with the usual credentials, instead of connecting to the server. The Proxy acts as man-in-the-middle between client and server.

In its basic form, the Proxy is just a redirector. It gets an empty bucket from the client (a query), takes it to the server, fills the bucket with data, and passes it back to the client.

If that were all, the Proxy would just be useless overhead. There is a little more I haven’t told you yet. The Proxy ships with an embedded Lua interpreter. Using Lua, you can define what to do with a query or a result set before the Proxy passes them along.

MySQL Proxy Load balancing and Failover Tutorial - Logo

Download MySQL proxy

You can download MySQL proxy here

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 11 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
11 comments… add one
  • matthias Aug 10, 2007 @ 16:11

    Anyone tested this already? Sounds relly nice, but seems to be very new software…

  • FreeBSD Geek Jun 25, 2008 @ 23:38

    Yes, anyone out there who have tested this? espcialy on a set of freebsd servers?

  • Wagner Bianchi Apr 21, 2009 @ 17:48

    I have tested on a lab and it works fine. ItÅ› a new software and have something to improve.

  • dose Jul 2, 2009 @ 8:12

    mysql-proxy which running on freebsd 7.2 not open a port

  • Nikolay Mihaylov Jul 27, 2010 @ 7:39

    anyone tested proxy + replication and read-only / read-write back-ends ?

  • gaous afrizal Mar 11, 2011 @ 10:08

    actually i wanna try this for my final project undergraduate
    but is it possible to create load balancer based on performance from database server using this one? 🙂

  • yuki_1991 Jun 13, 2012 @ 8:33

    i jus try it this week and i think that is a great software and a easy one to perform a load balanced cluster, but mysql-proxy works with lua scripts and only works with one each time, you need to learn hot to program in lua to make a failover, load balanced cluster with mysql-proxy only..
    mysql-proxy can be great but it needs more time and development.

  • Pramod Jun 15, 2012 @ 2:32

    Hi Vivek ,

    Can use mysql proxy for the production which has 20lakhs hit to the page and lots of inserts and writes, and reads, Pleas guide me if yes like which version i have to use and, can you suggest me the read write lua scripts. if mysql proxy is not suitable what is the opensource alternate to split the mysql db.

    Advance thanks

  • Jimmy Burnett Feb 7, 2013 @ 15:01

    This is in alpha and MySQL recommends not to use in production.

  • sreenadh May 12, 2013 @ 15:19

    I’ve extensive experience on mysqlproxy. If anyone want to know the details, please ;et me know

    • Cyril Jan 27, 2014 @ 15:02

      @sreenadh : I would be interest to find a workable failover script for Mysql-Proxy, if you have/know one, I would be really interested to try it !

      You can contact me via Twitter and we’ll share our email in DM.

      Thanks 🙂

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum