请教熟悉mysql-proxy的老大们:
mysql-proxy版本0.8.0
所在目录:/system/mysql-proxy
mysql-proxy程序位置:/system/mysql-proxy/bin/mysql-proxy
lua脚本位置:/system/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua
启动mysql-proxy参数为:
/system/mysql-proxy/bin/mysql-proxy --daemon --proxy-address=172.168.1.101:3306 --proxy-backend-addresses=172.168.1.101:10001 --proxy-read-only-backend-addresses=172.168.1.102:10001 --proxy-fix-bug-25371 --proxy-skip-profiling --proxy-lua-script=/system/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua &
LUA_PATH: /system/mysql-proxy/lib/mysql-proxy/lua/?.lua;/system/mysql-proxy/share/doc/mysql-proxy/?.lua
LUA_CPATH: /system/mysql-proxy/lib/mysql-proxy/lua/?.so;
启动mysql-proxy时出现
[root@db_d system]# /system/mysql-proxy/bin/mysql-proxy --daemon --proxy-address=172.168.1.101:3306 --proxy-backend-addresses=172.168.1.101:10001 --proxy-read-only-backend-addresses=172.168.1.102:10001 --proxy-lua-script=/system/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua &
[1] 7019
[root@db_d system]# 2010-05-16 00:21:57: (critical) chassis-limits.c:81: could not raise RLIMIT_NOFILE to 8192, Invalid argument (22). Current limit still 1024.
PS查看进程有mysql-proxy进程
netstat -tnl查看端口,有mysql-proxy启动时指定的端口(3306,4041)
php测试页
$cn=mysql_connect('172.168.1.101:3306','hanyang','hanyang');
echo $cn;
可以输出连接表示符,说明连接是没有问题的
但是在执行SQL语句时,程序无反应,无报错,主从数据库无数据。sql语句为insert语句
通过windows下的mysql控制台连接mysql-proxy服务器即172.168.1.101:3306,连接成功,在执行show databases查看数据库时
出现如下错误:
mysql> show databases;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 27
Current database: *** NONE ***
ERROR 2013 (HY000): Lost connection to MySQL server during query
请有知道的老大,告知解决办法,先谢谢了
而且linux的终端管理器也就是SSH窗口提示如下错误
2010-05-15 23:15:21: (critical) (read_query) [string "/system/mysql-proxy/share/doc/mysql-proxy/r..."]:217: bad argument #1 to 'ipairs' (table expected, got userdata)
2010-05-15 23:15:21: (critical) proxy-plugin.c.1130: I have no server backend, closing connection
2010-05-15 23:15:21: (critical) network-mysqld.c.1293: plugin_call(CON_STATE_READ_QUERY) failed
2010-05-15 23:15:24: (critical) proxy-plugin.c:1390: (connect_server) [string "/system/mysql-proxy/share/doc/mysql-proxy/r..."]:75: attempt to get length of field 'backends' (a nil value)
楼上的兄弟,mysql-proxy以前测试过,默认的rw-splitting.lua脚本是有问题,你需要修改一下(具体搜一下,网上挺多这样的讨论)
其实不知道生产上大家是否有应用mysql-proxy的案例。
如果你应用到生产线上别忘记和大家分享哦,谢谢了!