While working on a MySQL Galera cluster with ProxySQL, I was in the process of testing traffic going to the MySQL nodes by using the @@hostname command to ensure which MySQL host behind the proxy the query ran on. This was important as my client is using query rules to route traffic according to the rule to either the master or the slave. But to my surprise, I didn’t always get the result that I was expecting. This is where ProxySQL multiplexing comes into play.
In my scenario, I was on a test server connecting to ProxySQL which was then routing my queries to the MySQL Galera nodes. I would connect into ProxySQL using the MySQL client.
Important note: When testing query routing with ProxySQL using comments and the MySQL client, you have to use the “-c” command line option in order for the comment to not be stripped away when running queries. You …[Read more]