2012년 5월 27일 일요일
❑ failover.lua
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
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
logfile=io.open("/database/mysql-proxy/access.log", "a+")
logfile:write("************* Query Information *************\n")
logfile:write(" Thread ID : " .. proxy.connection.server.thread_id .. "\n")
logfile:write(" Server IP : " .. proxy.connection.server.dst.name .. "\n")
logfile:write(" Client IP : " .. proxy.connection.client.dst.name .. "\n")
logfile:write(" Current Time : " .. os.date("%Y/%m/%d %H:%M:%S") .. "\n")
if packet:byte() == proxy.COM_QUERY then
logfile:write(" Query Statement :" .. packet:sub(2) .. "\n")
end
io.close(logfile)
end
]]--
function read_handshake()
logfile=io.open("/database/mysql-proxy/access.log", "a+")
logfile:write("************* Connection Information *************\n")
logfile:write(" MySQL Version : " .. proxy.connection.server.mysqld_version .. "\n")
logfile:write(" Thread ID : " .. proxy.connection.server.thread_id .. "\n")
logfile:write(" Server IP : " .. proxy.connection.server.dst.name .. "\n")
logfile:write(" Client IP : " .. proxy.connection.client.src.name .. "\n")
logfile:write(" Current Time : " .. os.date("%Y/%m/%d %H:%M:%S") .. "\n")
io.close(logfile)
end
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기