MySQL Forums
Forum List  »  Router & Proxy

About r/w splitting,and there have a error.anxious,anxious,anxious,thanks!!!!
Posted by: cerlin gao
Date: September 05, 2007 06:39PM

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)

client #2:

mysql> SELECT * from `Group`;
+----+----------+---------
| id | uid | name
+----+----------+----------
| 1 | 1 | aaaa |
|
+----+----------+----------
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.

There have a error like this:

(read_query)..in/mysql-proxy/trunk/examples/tutorial-keepalive.lua:172: attempt to index field `server` (a nil value)
network-mysqld-proxy.c.2839: I have no server backend.closing connection
network-mysqld.c.1117: plugin_call(CON_STATE_READ_QUERY) failed

Options: ReplyQuote




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.