MySQL Forums
Forum List  »  Router & Proxy

NEW:About r/w splitting,isnot achieve r/w splitting
Posted by: cerlin gao
Date: September 06, 2007 06:25PM

Hello,I start mysql-proxy like this,

LUA_PATH="/usr/local/tools/mysql-proxy/trunk/lib/xtab.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/turial-keepalive.lua

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

192.168.0.7:
mysql> SELECT * from `Group`;
+----+----------+---------
| id | uid | name
+----+----------+----------
| 1 | 1 | aaaa |
|
+----+----------+----------
1 rows in set (0.00 sec)

192.168.0.6:
mysql> select * from `Group`;
+----+----------+----
| id | uid | name |
+----+----------+-------
| 1 1 nnnnnn
+----+----------+------
4 rows in set (0.00 sec)

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

mysql -h 192.168.0.7 -P 4040

client #1:
mysql> SELECT * from `Group`;
+----+----------+---------
| id | uid | name
+----+----------+----------
| 1 | 1 | aaaa |
|
+----+----------+----------
1 rows in set (0.00 sec)

mysql -h 192.168.0.7 -P 4040
client #2:

mysql> SELECT * from `Group`;
+----+----------+---------
| id | uid | name
+----+----------+----------
| 1 | 1 | aaaa |
|
+----+----------+----------
1 rows in set (0.00 sec)

And sometimes show like this:
mysql -h 192.168.0.7 -P 4040

client #1:
mysql> SELECT * from `Group`;
+----+----------+---------
| id | uid | name
+----+----------+----------
| 1 | 1 | aaaa |
|
+----+----------+----------
1 rows in set (0.00 sec)

mysql -h 192.168.0.7 -P 4040
client #2:

mysql> SELECT * from `Group`;
+----+----------+---------
| id | uid | name
+----+----------+----------
| 1 | 1 | nnnnnn|
|
+----+----------+----------
1 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. And is not connect read only server.

How to make it run in a r/w splitting. Or this lua script have error?Please send me a right script.Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
NEW:About r/w splitting,isnot achieve r/w splitting
3574
September 06, 2007 06:25PM


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.