AboutMysql Proxy LUARead/writeSeparationIs the content to be introduced in this article, mainly to understandMysql Proxy LUAFor more information, see the detailed description of this Article. First, download the matching version:
- http://mysql.cdpa.nsysu.edu.tw/Downloads/MySQL-Proxy/
Download the latest binary version, taking mysql-proxy-0.8.0-linux-glibc2.3-x86-32bit as an example. Download lua from www.lua.org.
1. Use mysql proxy mysql-proxy to read and write mysqlSeparation.
MySQL Proxy installation address: 192.168.0.234, or install mysql-proxy on the third server)
MySQL server address: 192.168.0.235 read)
2. Install mysql-proxy
- apt-get install mysql-proxy
After installation, there is no rw-splitting.lua file in/usr/lib/mysql-proxy/lua/proxy, copy the share/doc/mysql-proxy/Following the rw-splitting.lua file in the exported lua binary version to/usr/lib/mysql-proxy/lua/proxy/
3. Start mysql-proxy
If this parameter does not exist, create the mysql-proxy log directory mkdir/var/log/mysql-proxy/
Start the mysql-proxy command:
- mysql-proxy --proxy-read-only-backend-addresses=192.168.0.235:3306
- --proxy-backend-addresses=192.168.0.234:3306
- --proxy-lua-script=/usr/lib/mysql-proxy/lua/proxy/rw-splitting.lua > /var/log/mysql-proxy/mysql-proxy.log &
Startup status:
- root@ubuntu:~# mysql-proxy --proxy-read-only-backend-addresses=192.168.0.235:3306
- --proxy-backend-addresses=192.168.0.234:3306
- --proxy-lua-script=/usr/lib/mysql-proxy/lua/proxy/rw-splitting.lua > /var/log/mysql-proxy/mysql-proxy.log &
- [1] 1584
- root@ubuntu:~# 2010- 03-11 01:53:36: (warning) g_set_prgname() called multiple times
- 2010-03-11 01:53:36: (critical) chassis.c:980: could not raise RLIMIT_NOFILE to 8192,
- Invalid argument (22). Current limit still 13214421558589654016.
Check the ports. The default ports of mysql-proxy are 4040 and 4041.
- lsof -i:4040
-
- root@ubuntu:~# lsof -i:4040
- COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
- mysql-pro 1584 root 7u IPv4 6018 0t0 TCP *:4040 (LISTEN)
This indicates that mysql-proxy has been started successfully.
Garbled processing is added under the server-id in the configuration file my. conf.
- skip-character-set-client-handshake
- init-connect='SET NAMES utf8'
- default-character-set=utf8
Summary: AboutMysql Proxy LUAMysql read/writeSeparationI hope this article will help you!