MySQL Forums
Forum List  »  Router & Proxy

mysql proxy 0.8 problem with failover.lua script
Posted by: syed raza
Date: November 01, 2011 02:07AM

hello.
Im having serious problem with mysql-proxy.

i have copied the simple failover.lua script but it gives error.

attempt to get length of field 'backend' (a nil value)
OS# debian squeeze 32 bit


#mysql-proxy --version
mysql-proxy 0.8.0
glib2: 2.24.2
libevent: 1.4.13-stable
lua: Lua 5.1.4
LUA_PATH: /usr/lib/mysql-proxy/lua/?.lua
LUA_CPATH: /usr/lib/mysql-proxy/lua/?.so
== plugins ==
admin: 0.7.0
proxy: 0.7.0




mysql-proxy.cnf file:

daemon = true
pid-file = /etc/mysql-proxy/mysql-proxy.pid
log-file = /etc/mysql-proxy/mysql-proxy.log
log-level = debug
proxy-address = :3306
proxy-backend-addresses = 192.168.0.194:3302
proxy-backend-addresses = 192.168.0.133:3306
proxy-lua-script = /etc/mysql-proxy/failover.lua
LUA_PATH = /usr/lib/mysql-proxy/lua/proxy/?.lua
LUA_CPATH = /usr/lib/mysql-proxy/lua/?.so
plugin-dir = /usr/lib/mysql-proxy/plugins/
plugins=proxy,debug,admin,replicant
event-threads = 2
max-open-files = 1024


failover.lua

function connect_server()
for i = 1, #proxy.backends do
local s = proxy.backends

if s.state ~= proxy.BACKEND_STATE_DOWN then
proxy.connection.backend_ndx = i
-- print ("connecting to " .. i)
return
end
end
end

function read_query(packet)
for i = 1, #proxy.backends do
local s = proxy.backends

if s.state ~= proxy.BACKEND_STATE_DOWN then
proxy.connection.backend_ndx = i
-- print ("connecting to " .. i)
return
end
end
end


RUN by this command
mysql-proxy --defaults-file=/etc/mysql-proxy/mysql-proxy.cnf


log:
011-11-01 13:42:03: (critical) (read_query) [string "/etc/mysql-proxy/failover.lua"]:14: attempt to get length of field 'backends' (a nil value)
2011-11-01 13:42:04: (critical) last message repeated 101 times
2011-11-01 13:42:04: (critical) (read_query) [string "/etc/mysql-proxy/failover.lua"]:14: attempt to get length of field 'backends' (a nil value)
2011-11-01 13:42:04: (critical) last message repeated 101 times
2011-11-01 13:42:04: (critical) (read_query) [string "/etc/mysql-proxy/failover.lua"]:14: attempt to get length of field 'backends' (a nil value)
2011-11-01 13:42:14: (debug) last message repeated 91 times

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql proxy 0.8 problem with failover.lua script
59155
November 01, 2011 02:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.