For analysis, monitoring, and transformation of communication data MySQL-Proxy (1) [figure] TIP: MySQL-Proxy is a program between the MySQL database client and the server. it supports the embedded scripting language Lua. This proxy can be used to analyze, monitor, and transform communication data. it supports a wide range of application scenarios: load balancing and failover processing query analysis and log SQL macro (SQL macros) query rewriting execution shell
The MySQL-Proxy program is located between the MySQL database client and the server. it supports the embedded script language Lua. This proxy can be used to analyze, monitor, and transform communication data. it supports a wide range of application scenarios:
? Load balancing and failover
? Query analysis and logs
? SQL macro (SQL macros)
? Query rewriting)
? Execute shell commands
One of the most powerful functions of MySQL Proxy is to implement Read/Write Splitting )". The basic principle is to allow the primary database to process Transactional queries, but to process SELECT queries from the database. Database replication is used to synchronize changes caused by Transactional queries to the slave database in the cluster.
Jan Kneschke detailed this technique and connection pool problems in MySQL Proxy learns R/W Splitting:
To achieve read/write splitting, we need a connection pool. We can switch to the backend only when an authenticated connection has been enabled to a backend. The MySQL protocol first shakes hands. It is too late to authenticate the new connection when the query/return result is reached. We must ensure that we have enough open connections to maintain normal operation.
LUA script for read/write splitting:
-- Read/write splitting
--
-- Send all non-transactional Select statements to a slave database