I managed to get rw-splitting working but there's some more questions coming to my mind now ! : (see bottom for how I set up rw-splitting)
1.
What does the max_idle and min_idle variables (default 8 and 4) in rw-splitting.lua do ? I dont really get it...
I see that if I connect more than 4-5 clients to the proxy, I'm automatically redirected to a slave (for SELECT'S) so I guess min_idle is for that.
But what max_idle means ?
2.
Having multiple slaves is good but how do the proxy chooses to take the client from one slave to another ? If there's a lot of people on one slave will the proxy redirects others to the second slave ? And if yes, is there a setting for this ? (Like a "max_slave_clients=4000)
3.
Is it possible to add several master servers ? (for INSERT'S and UPDATE'S) And if yes i guess the command is : --proxy-backend-addresses=:3306 --proxy-backend-addresses=:3309 ...
But then same question as 2., how do the proxy will say "you go to master1" "you go to master2" ?
I think it's the connexion pool concept that I must understand better. And the two parameters min_idle, max_idle.
EDIT : i foud this :
http://forge.mysql.com/w/images/d/dd/MySQL-Proxy.pdf which explains a lot of things but i'm stuck with min_idle and max_idle... !
The good part : "HOW TO SET U MYSQL-PROXY" (how I did it ..) :
Hello, I saw a list of problems with r/w splitting on the forums.
I kind of managed to get it work as expected :
I use latest mysql-proxy version (fedora 4.0 bin from the downloads)
I use lastest rw-splitting.lu from the svn (http://svn.mysql.com/svnpublic/mysql-proxy/trunk/lib/rw-splitting.lua)
The command to launch my server is : (pwd included)
[root@xxxx sbin]# pwd
/root/proxy/mysql-proxy-0.6.0-linux-fc4-x86/sbin
[root@xxxx sbin]# LUA_PATH="../share/mysql-proxy/?.lua" ./mysql-proxy --proxy-lua-script=../share/mysql-proxy/rw-splitting.lua --proxy-backend-addresses=:3306 --proxy-read-only-backend-addresses=:3307 --proxy-read-only-backend-addresses=:3308
I use rinetd to redirect ports :3307 and :3308 to the slaves real ip adresses.
Then choose a mysql client and connect to the proxy :
mysql --host=proxyip --port=4040 -p -u youruser
You MUST have youruser@proxyip having privileges on EACH slaves mysql users privileges
I did it for some time and with only one client it "doesn't" work AS EXPECTED but connect more than 5 clients and you'll see that the connection id you get doesnt follow the last you had. If you do a select you'll then always get on the slaves and insert or updates will get you on the master.
Then this is a bit magic because you don't really know why you get on slave 1 or 2 or 3 ... But it works ;)
Edited 1 time(s). Last edit at 12/13/2007 09:49AM by Vincent Voyer.