Description:
Testing on Fedora 7 32-bit.
could not get a usable rpm built from SVN so I installed the tarball version built from SVN. I setup the /etc/init.d/mysql-proxy control and put all the mysql-proxy option into /etc/sysconfig/mysql-proxy.
I start the proxy and it reports ...running.
When I access the host and port for the proxy I see one of several things:
[root@grp-01-60-50 trunk]# mysql -h 127.0.0.1 -P 4040 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
[root@grp-01-60-50 trunk]#
in /var/log/messages:
Apr 18 09:39:26 grp-01-60-50 kernel: mysql-proxy[17850]: segfault at 00000000 eip 002a25ec esp bfc0a84c error 4
(this happens if you have the path typo to the lua script; better if the proxy would tell you this at startup instead of letting daemon segfault)
OR
[root@grp-01-60-50 network-scripts]# mysql -h 127.0.0.1 -P 4040 -u root -p
Enter password:
2008-04-18 09:19:27: (critical) (lua-error) [/usr/local/share/mysql-proxy/rw-splitting.lua]
[string "/usr/local/share/mysql-proxy/rw-splitting.l..."]:30: module 'proxy.commands' not found:
no field package.preload['proxy.commands']
no file './proxy/commands.lua'
no file '/usr/share/lua/5.1/proxy/commands.lua'
no file '/usr/share/lua/5.1/proxy/commands/init.lua'
no file '/usr/lib/lua/5.1/proxy/commands.lua'
no file '/usr/lib/lua/5.1/proxy/commands/init.lua'
no file './proxy/commands.so'
no file '/usr/lib/lua/5.1/proxy/commands.so'
no file '/usr/lib/lua/5.1/loadall.so'
no file './proxy.so'
no file '/usr/lib/lua/5.1/proxy.so'
no file '/usr/lib/lua/5.1/loadall.so'
So I try searching for proxy.commands:
[root@grp-01-60-50 trunk]# find /usr/local -name "commands*"
/usr/local/share/mysql-proxy/proxy/commands.lua
[root@grp-01-60-50 trunk]#
Here is my /etc/sysconfig/mysql-proxy:
PROXY_OPTIONS="--daemon --proxy-lua-script=/usr/local/share/mysql-proxy/rw-splitting.lua --proxy-address=127.0.0.1:4040 --proxy-backend-addresses=192.168.1.245:3306 --proxy-read-only-backend-addresses=192.168.1.246:3306"
Ok, so I try this basically verbatim from the rw tutorial page:
[root@grp-01-60-50 trunk]# export LUA_PATH='lib/?.lua'; ./src/mysql-proxy --daemon --proxy-lua-script=lib/rw-splitting.lua --proxy-address=127.0.0.1:4040 --proxy-backend-addresses=192.168.1.245:3306 --proxy-read-only-backend-addresses=192.168.1.246:3306
[root@grp-01-60-50 trunk]# ps -ef | grep proxy
root 22636 1 0 11:54 ? 00:00:00 /root/build/mysql-proxy/trunk/src/.libs/lt-mysql-proxy --daemon --proxy-lua-script=lib/rw-splitting.lua --proxy-address=127.0.0.1:4040 --proxy-backend-addresses=192.168.1.245:3306 --proxy-read-only-backend-addresses=192.168.1.246:3306
[root@grp-01-60-50 trunk]#
[root@grp-01-60-50 trunk]# mysql -h 127.0.0.1 -P 4040 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
[root@grp-01-60-50 trunk]#
mysql-proxy segfaults.
UPDATE: here's an strace:
epoll_wait(3, {}, 1023, 1000) = 0
gettimeofday({1208536341, 610780}, NULL) = 0
gettimeofday({1208536341, 611320}, NULL) = 0
gettimeofday({1208536341, 611626}, NULL) = 0
gettimeofday({1208536341, 611925}, NULL) = 0
epoll_wait(3, {{EPOLLIN, {u32=135811920, u64=135811920}}}, 1023, 1000) = 1
gettimeofday({1208536342, 115342}, NULL) = 0
accept(7, {sa_family=AF_INET, sin_port=htons(46134), sin_addr=inet_addr("127.0.0.1")}, [16]) = 8
fcntl64(8, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1208536342, 117810}, NULL) = 0
stat64("lib/rw-splitting.lua", 0xbfbd1fe8) = -1 ENOENT (No such file or directory)
open("lib/rw-splitting.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
Process 22992 detached
How to repeat:
checkout mysql-proxy from svn
autogen
configure
make
make install
running mysql-proxy fails