Bug #48928 Admin interface of mysql proxy does not work
Submitted: 20 Nov 2009 4:13 Modified: 9 Jan 2015 14:39
Reporter: Alexey Kishkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy Severity:S3 (Non-critical)
Version:0.7.2 OS:Any (opensolaris 2009.6, mac)
Assigned to: Assigned Account CPU Architecture:Any

[20 Nov 2009 4:13] Alexey Kishkin
Description:
Admin interface of mysql proxy (that on port 4041), appears, does not work on opensolaris. it returns error after each query.

I installed mysql proxy from binary mysql-proxy-0.7.2-solaris10-x86-32bit.tar.gz

How to repeat:
mysql_proxy --proxy-backend-addresses=some_backend --admin-username=walrus --admin-password=ok

in another xterm

mysql -h 127.0.0.1 -P 4041 -pok -u walrus

select * from proxy_config;

and get:

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connect Id:   1
Current database: *** None ***
ERROR 1105 (07000): need a resultset = proxy.PROXY_SEND_RESULT

I believe here must be config of proxy instead of error message.
[20 Nov 2009 6:54] Sveta Smirnova
Thank you for the report.

Verified as described.
[20 Nov 2009 11:47] Diego Medina
Hi,

The mysql proxy 0.7.2 has an undocumented change on the admin interface. The 
mysql proxy >= 0.7.2 needs a lua script in order to provide meaningful 
information.
On previous versions, the admin interface had hardcoded functions in the C 
layer.

Please try the lua script found on this entry:
http://fmpwizard.blogspot.com/2009/04/how-do-i-use-mysql-proxy-admin-plugin.html

and tell us if you still see the same error.

Thanks

Diego
[20 Nov 2009 20:01] Sveta Smirnova
With new scripts almost works in my case:

$mysql -h127.0.0.1 -P4041 -pok
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.99-agent-admin

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select * from proxy_config;
ERROR 1105 (07000): error
mysql> SHOW PROXY PROCESSLIST;
ERROR 1105 (07000): need a resultset + proxy.PROXY_SEND_RESULT ... got something else
mysql> SELECT * FROM backends;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: *** NONE ***

+-------------+----------------+-------+------+
| backend_ndx | address        | state | type |
+-------------+----------------+-------+------+
|           1 | 127.0.0.1:3306 | 0     | 1    |
+-------------+----------------+-------+------+
1 row in set (0.01 sec)

mysql> show querycounter;
+---------------+
| query_counter |
+---------------+
|          NULL |
+---------------+
1 row in set (0.00 sec)

$mysql-proxy --version
mysql-proxy 0.8.0
  glib2: 2.16.3
  libevent: 1.4.8-stable
  lua: Lua 5.1.4
    LUA_PATH: /usr/local/share/mysql-proxy/?.lua
    LUA_CPATH: /usr/local/lib/mysql-proxy/?.so
  == plugins ==
  admin: 0.7.0
  proxy: 0.7.0

But I believe documentation should be updated anyway.
[25 Nov 2009 10:28] Nicklas Westerlund
Diego mentions that this behavior was changed in 0.7.2, however it still happens on 0.7.1 as I can confirm. 

The link referenced earlier in this bug also states that the lua scripts work with version >= 0.7.0 

What is the correct version?
[25 Nov 2009 11:23] Sveta Smirnova
This is MySQL Proxy from Launchpad, revision 1077.
[29 Nov 2009 13:03] Alexey Kishkin
but in any case error message must not be so confusing. Can we change error message in case of lacking .lua files of admin interface?
[3 May 2010 17:35] Tiago Geada
Hi!

I am having the same problem.
Mysql proxy version:

MySQLser:/usr/src/mysql-proxy/bin# ./mysql-proxy --version
mysql-proxy 0.8.0
  glib2: 2.16.6
  libevent: 1.4.6-stable
  lua: Lua 5.1.4
    LUA_PATH: /usr/src/mysql-proxy/lib/mysql-proxy/lua/?.lua;
    LUA_CPATH: /usr/src/mysql-proxy/lib/mysql-proxy/lua/?.so;
  == plugins ==
  admin: 0.7.0
  proxy: 0.7.0

mysql-proxy is being launched like:

OPTIONS="--proxy-backend-addresses=192.168.2.1:3306 --proxy-backend-addresses=192.168.2.32:3306 --proxy-backend-addresses=192.168.2.34:3306 --log-level=debug --log-file=/var/log/mysql-proxy/mysql-proxy.log --admin-username=root --admin-password=blabla --admin-lua-script=admin.lua --admin-lua-script=reporter.lua --proxy-lua-script=loadBalanceUserz.lua"

when I connect to mysql proxy it errors with the no database selected:

cusco@Marte:~$ mysql -uroot -p -h192.168.2.30 -P4041
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.99-agent-admin

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show querycounter;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: *** NONE ***

ERROR 1105 (07000): need a resultset + proxy.PROXY_SEND_RESULT

What can I do?
[16 Dec 2010 10:26] Enterprise Tools JIRA Robot
Jan Kneschke writes: 
In 0.8.1 the admin script was cleaned up:

1) --admin-username, --admin-password and --admin-lua-script have to be set
2) if admin-username doesn't match, the client gets:

$ mysql --port=4041 --user=unknown
ERROR 1045 (28000): unknown user

3) if the password doesn't match:

$ mysql --port=4041 --user=admin
ERROR 1045 (28000): password doesn't match

4) if the script fails or can't be loaded:

$ mysql --port=4041 --user=foo --password=bar
mysql> select * from config;
ERROR 1105 (07000): MySQL Proxy Lua script failed to load. Check the error log.