mysql-proxy-discuss team mailing list archive
-
mysql-proxy-discuss team
-
Mailing list archive
-
Message #00278
Read write splitting
Dear all,
I have just installed mysql-proxy and I am trying to test the read/write
splitting but I have some difficulties. I have one master server and one
slave and I would like mysql-proxy to send the read queries to the slave and
write statements to the master but right now everything goes to the master.
If anyone knows what my problem might be I would be very grateful!
I start the proxy with the following script:
#!/bin/bash
MASTER=172.16.86.129
SLAVE=172.16.86.130
ROOT_DIR=/usr/local
LUA_PATH='$ROOT_DIR/mysql-proxy/share/doc/mysql-proxy/?.lua'
$ROOT_DIR/mysql-proxy/bin/mysql-proxy \
--log-level=debug \
--proxy-backend-addresses=$MASTER:3306 \
--proxy-read-only-backend-addresses=$SLAVE:3306 \
--proxy-lua-script=$ROOT_DIR/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua
# End script
Then I start my mysql client on the proxy:
mysql -u stress -h127.0.0.1 -P 4040 stress
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 148
Server version: 5.0.51a-24+lenny1-log (Debian)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select * from t;
+--------+
| answer |
+--------+
| 42 |
+--------+
1 row in set (0.01 sec)
>From my debug window I see the follow information:
2010-03-23 15:46:59: (message) mysql-proxy 0.8.0 started
2010-03-23 15:46:59: (debug) chassis-limits.c:75: current RLIMIT_NOFILE =
1024 (hard: 1024)
2010-03-23 15:46:59: (debug) chassis-limits.c:79: trying to set new
RLIMIT_NOFILE = 8192 (hard: 1024)
2010-03-23 15:46:59: (critical) chassis-limits.c:81: could not raise
RLIMIT_NOFILE to 8192, Invalid argument (22). Current limit still 1024.
2010-03-23 15:46:59: (message) proxy listening on port :4040
2010-03-23 15:46:59: (message) added read/write backend: 172.16.86.129:3306
2010-03-23 15:46:59: (message) added read-only backend: 172.16.86.130:3306
[connect_server] 127.0.0.1:39355
[1].connected_clients = 0
[1].pool.cur_idle = 0
[1].pool.max_idle = 8
[1].pool.min_idle = 4
[1].type = 1
[1].state = 0
[1] idle-conns below min-idle
[read_query] 127.0.0.1:39355
current backend = 0
client default db = stress
client username = stress
query = show databases
sending to backend : 172.16.86.129:3306
is_slave : false
server default db: stress
server username : stress
in_trans : false
in_calc_found : false
COM_QUERY : true
# cut a lot of info
[read_query] 127.0.0.1:39355
current backend = 0
client default db = stress
client username = stress
query = select * from t
sending to backend : 172.16.86.129:3306
is_slave : false
server default db: stress
server username : stress
in_trans : false
in_calc_found : false
COM_QUERY : true
As you can see, everything goes to my master (IP ending in .129).
Thanks in advance for any help!
best regards,
--
Joakim
Follow ups