Quick Start: ProxySQL Integration
dbdeployer can deploy a ProxySQL instance alongside a replication topology, pre-configured with read/write splitting. Assumes MySQL 8.4 is already unpacked (see Quick Start: MySQL Single).
Prerequisites
Section titled “Prerequisites”- dbdeployer installed with MySQL 8.4 unpacked in
~/opt/mysql/ - ProxySQL binary available on
PATH(e.g./usr/bin/proxysql)
1. Deploy replication with ProxySQL
Section titled “1. Deploy replication with ProxySQL”dbdeployer deploy replication 8.4.4 --with-proxysqlExpected output:
Replication directory installed in $HOME/sandboxes/rsandbox_8_4_4master on port 20192slave1 on port 20193slave2 on port 20194ProxySQL admin on port 6032ProxySQL proxy on port 6033dbdeployer starts the MySQL topology, launches ProxySQL, and configures hostgroups for write (master) and read (slaves).
2. Open the ProxySQL admin interface
Section titled “2. Open the ProxySQL admin interface”~/sandboxes/rsandbox_8_4_4/proxysql/useYou are now in the ProxySQL admin shell. Inspect the hostgroups:
SELECT hostgroup_id, hostname, port, status FROM runtime_mysql_servers;3. Connect through the proxy
Section titled “3. Connect through the proxy”~/sandboxes/rsandbox_8_4_4/proxysql/use_proxyThis opens a MySQL connection routed through ProxySQL on port 6033. Writes are sent to the master; reads are distributed across the slaves automatically.
Try it:
-- this SELECT will be routed to a slaveSELECT @@hostname;
-- DML is routed to the masterCREATE DATABASE proxydemo;4. Clean up
Section titled “4. Clean up”dbdeployer delete rsandbox_8_4_4This stops ProxySQL and all MySQL nodes and removes the sandbox directory.
What’s next?
Section titled “What’s next?”- ProxySQL integration guide — hostgroups, query rules, custom config
- Replication topologies — fan-in, all-masters, group replication