MySQL Forums
Forum List  »  Router & Proxy

Question about balance in R/W Splitting
Posted by: vox huang
Date: September 04, 2007 10:05PM

Hello,I start mysql-proxy like this,

LUA_PATH="/usr/local/tools/mysql-proxy/trunk/lib/?.lua" /usr/local/sbin/mysql-proxy --proxy-backend-addresses=192.168.0.7:3306 --proxy-read-only-backend-addresses=192.168.0.6:3306 --proxy-lua-script=/usr/local/tools/mysql-proxy/trunk/lib/rw-splitting.lua

I have different data sets on both servers,with the same database name,the same table name and structure, only the data differs.

Master:
mysql> SELECT * from test;
+----+----------+----------+-----+-----+
| id | username | password | sex | age |
+----+----------+----------+-----+-----+
| 1 | abc | bbb | 1 | 0 |
| 3 | abc | 123 | 1 | 0 |
| 4 | abc | bbb | 1 | 0 |
| 5 | 你 | 123 | 1 | 1 |
| 6 | aaaa | bbbb | 0 | 0 |
| 8 | ins | ins | 1 | 1 |
+----+----------+----------+-----+-----+
6 rows in set (0.00 sec)

slaver:
mysql> select * from t_user;
+----+----------+----------+-----+-----+
| id | username | password | sex | age |
+----+----------+----------+-----+-----+
| 1 | abc | bbb | 1 | 0 |
| 3 | abc | 123 | 1 | 0 |
| 4 | abc | bbb | 1 | 0 |
| 5 | 你 | 123 | 1 | 1 |
+----+----------+----------+-----+-----+
4 rows in set (0.00 sec)

then I connect mysql-proxy from 6 clients like this,

mysql -h 192.168.0.7 -P4040

client #1:
mysql> SELECT * from test;
+----+----------+----------+-----+-----+
| id | username | password | sex | age |
+----+----------+----------+-----+-----+
| 1 | abc | bbb | 1 | 0 |
| 3 | abc | 123 | 1 | 0 |
| 4 | abc | bbb | 1 | 0 |
| 5 | 你 | 123 | 1 | 1 |
| 6 | aaaa | bbbb | 0 | 0 |
| 8 | ins | ins | 1 | 1 |
+----+----------+----------+-----+-----+
6 rows in set (0.00 sec)

the results of the other 5 clients are same like this,
mysql> select * from t_user;
+----+----------+----------+-----+-----+
| id | username | password | sex | age |
+----+----------+----------+-----+-----+
| 1 | abc | bbb | 1 | 0 |
| 3 | abc | 123 | 1 | 0 |
| 4 | abc | bbb | 1 | 0 |
| 5 | 你 | 123 | 1 | 1 |
+----+----------+----------+-----+-----+
4 rows in set (0.00 sec)

So it seems that the proxy won't connect each client to each server in a round-robin fashion.

How to make it run in a round-robin fashion

Thanks for your help

Options: ReplyQuote


Subject
Views
Written By
Posted
Question about balance in R/W Splitting
3055
September 04, 2007 10:05PM
2182
September 05, 2007 03:36AM


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.