MySQL Forums
Forum List  »  Router & Proxy

MySQL-proxy: Setting backend server after checking the SLAVE status
Posted by: Mo Dwalkr
Date: March 22, 2011 03:17AM

Hello,
here is my problem,
in a Master/SLAVE configuration, I'm trying to use MySQL-Proxy to switch between the Master and the Slave, but not only as a simple failover. Before sending a query from the client, the proxy must check the Slave status (SHOW SLAVE STATUS) and in the case the column Seconds_behind_master isn't zero, the client query must be sent to the Master.
Unfortunately I can't figure out how to do it [sequentially]. The only place i can put the client-Query and my Status-check in the Queue is read_query().
my code structure looks like this:

function read_query()
--append SHOW SLAVE STATUS in the query queue
-- save the client query in a local variable
-- send the query queue to the server
end
function read_query_result(inj)
-- analyse the query result (column seconds_behind_master in particular)
-- set flag
--append the client query in the queue
-- send the queue
end

function connect_server()
-- flag control
-- set Master or Slave UP/DOWN
end

I hope u could understand what my problem is.
Thank you for your help

Regards

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL-proxy: Setting backend server after checking the SLAVE status
3361
March 22, 2011 03:17AM


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.