Skip navigation links

MySQL Forums :: Proxy :: first time mysql proxy - failover


Advanced Search

first time mysql proxy - failover
Posted by: Hugo Ahlenius ()
Date: February 16, 2012 06:09AM

Hi,

I have just installed mysql proxy 0.8.2, and started playing with it. I am using it together with two MySQL 5.5 servers, listening on 3306, the proxy is running on 4040. Oh, and OS is Win 7 32-bit.

My problem is that that the mysql proxy checking the state of the servers doesn't seem like it should.

I start up the script, and it runs as it should. But when I shutdown the primary server, the script doesn't seem to recognize that - it still tries to connect to it...

mysql-proxy 0.8.2
chassis: mysql-proxy 0.8.2
glib2: 2.16.6
libevent: 1.4.12-stable
LUA: Lua 5.1.2
package.path: C:\ProgramX86\dev\mysql-proxy\lib\mysql-proxy\lua\?.lua
package.cpath: C:\ProgramX86\dev\mysql-proxy\bin\lua-?.dll
-- modules
proxy: 0.8.2

MY CONFIG----------------
[mysql-proxy]
proxy-address = :4040
proxy-backend-addresses = 10.3.0.9:3306,192.168.4.100:3306
proxy-lua-script = C:/ProgramX86/dev/mysql-proxy/failover3.lua
daemon = true

FAILOVER SCRIPT-----------
function connect_server()
if proxy.global.backends[1].state == proxy.BACKEND_STATE_DOWN then
proxy.connection.backend_ndx = 2
else
proxy.connection.backend_ndx = 1
end
print ("s Connecting: " .. proxy.global.backends[proxy.connection.backend_ndx].dst.name)
end

function read_query(packet)
if proxy.global.backends[1].state == proxy.BACKEND_STATE_DOWN then
proxy.connection.backend_ndx = 2
else
proxy.connection.backend_ndx = 1
end
print ("q Connecting: " .. proxy.global.backends[proxy.connection.backend_ndx].dst.name)
end

Options: ReplyQuote


Subject Views Written By Posted
first time mysql proxy - failover 2154 Hugo Ahlenius 02/16/2012 06:09AM


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.