MySQL Forums
Forum List  »  Router & Proxy

About r-w spliting
Posted by: bruce zuo
Date: June 16, 2011 11:15PM

Hi all:
Now we want to build a slave database server in China,the master is in USA.Using mysql replication to keep master-slave consistent,but there is a problem:"Delay".In php code ,there are some script like below:

$que= "insert into test values(100,200)";
$res = $dbw->query($que);
$que = "select id,name from test";
$res = $dbw->query($que);

When read point to slave,maybe can't get anything because "Delay",and then the logic has made a mistake.

Deal with this problem,we could modify PHP code ,when read and write all in one logic,connecting to master,other reads,connecting to slave.But this time,the web has already completed 80%,and team leader don't want modify php code,and ask me to solve this problem on database level.Mysql-proxy provide the function of w-r split,but when replication is not normal,it is also read on slave.

Our real intention is when page views from China,"China server" handle the request ,when page views from USA,"USA servr" handle the request.

Can you give me some suggest about my quesion?

Best Regards.
Bruce.

Options: ReplyQuote


Subject
Views
Written By
Posted
About r-w spliting
3051
June 16, 2011 11:15PM


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.