Continuing on the series of blog posts about ProxySQL. Today I will demonstrate how to put ProxySQL in front of your master and slave topology and distribute reads and writes between the servers, without the need of changing your application code. To install ProxySQL and some of its basic concepts, please read this blog post. On this tutorail, we will use 4 servers: ProxySQL (192.168.112.60) Node1 – Master (192.168.112.61) Node2 – Slave-1 (192.168.112.62) Node3 – Slave-3 (192.168.112.63) Servers With ProxySQL already installed, we will connect into the admin interface, add our 3 servers and configure Replication Hostgroup. Basically, we will tell ProxySQL which HG will be our master and which HG will be our slaves. ProxySQL differs master and slaves based on server read_only variable: $ mysql -u admin -padmin -h 127.0.0.1 -P . . .
On my last post I gave a gasp about some key concepts of ProxySQL. Today I will demonstrate how we can import all users from MySQL to ProxySQL To accomplish this, we will make use of,proxysql-admin a tool developed by Percona to help you manage and install ProxySQL. If you are using ProxySQL provided by Percona, this tool is already installed, otherwise, you can download it directly from Github. We will use the –syncusers option, which will connect to the desired MySQL server, read all users from mysql.user table and import or sync them to ProxySQL: proxysql-admin –cluster-username=[mysql-user] –cluster-password=[mysql-password] –cluster-port=[mysql-port] –cluster-hostname=[mysql-host] –syncusers This tool was originally designed to enhance the compatibility between ProxySQL and Percona XtraDB Cluster, so, many terminology mentions cluster, however, the functionality demonstrate on this post is fully compatible with Master-Slave. Here . . .