--proxy-read-only-backend-addresses doesn't actually work?

Asked by Ron Snyder

/usr/local/sbin/mysql-proxy --admin-address=127.0.0.1:4042 --proxy-address=127.0.0.1:4005 --proxy-backend-addresses=master-server:3306 --proxy-read-only-backend-addresses=load-balancer:3306 --log-level=debug --max-open-files=1024

Our scenario is this: We have mysql running on master-server, and 4 (read-only) slaves that are load balanced behind a linux load balancer running ldirectord. The linux load balancer works fine -- this set up worked using mysql-proxy 0.6.3 (apart from issues that we felt were due to 0.6.3), so we are trying to upgrade to 0.7.0.

It appears that mysql-proxy is never even trying to open any connections to the read-only slave address-- ALL queries are directed to the master. What we want is for the writes to go to the master, and the reads to go to the slaves. I have verified using tcpdump that no traffic is going to the load-balancer:3306 address, either when the proxy starts up or when clients actually start connecting to the proxy.

I've dug into the code enough to prove that the proxy-read-only-backend-addresses parameter is actually being read, but it's been years since I've done any c, so am a bit behind in figuring out what is going on. Has anybody else seen this behavior? Known issue, or just silliness on my part that I've forgot something?

Thanks,
-ug

Question information

Language:
English Edit question
Status:
Solved
For:
MySQL Proxy Edit question
Assignee:
No assignee Edit question
Solved by:
Ron Snyder
Solved:
Last query:
Last reply:
Revision history for this message
fmpwizard (diego-fmpwizard) said :
#1

Hi Ron,

Just setting the --proxy-read-only-backend-addresses parameter is not
enough to have it work the way you'd expect it :/

It turns out you need to also use a Lua script to separate which
queries go to the master and what queries go to the read-only
backend.

For an example you can look at the rw-splitting.lua file. You may need
to modify that file to fit your needs.

Thanks

Diego

On Thu, Apr 23, 2009 at 6:58 PM, Ron Snyder
<email address hidden> wrote:
> New question #68398 on MySQL Proxy:
> https://answers.launchpad.net/mysql-proxy/+question/68398
>
> /usr/local/sbin/mysql-proxy --admin-address=127.0.0.1:4042 --proxy-address=127.0.0.1:4005 --proxy-backend-addresses=master-server:3306 --proxy-read-only-backend-addresses=load-balancer:3306 --log-level=debug --max-open-files=1024
>
> Our scenario is this: We have mysql running on master-server, and 4 (read-only) slaves that are load balanced behind a linux load balancer running ldirectord. The linux load balancer works fine -- this set up worked using mysql-proxy 0.6.3 (apart from issues that we felt were due to 0.6.3), so we are trying to upgrade to 0.7.0.
>
> It appears that mysql-proxy is never even trying to open any connections to the read-only slave address-- ALL queries are directed to the master. What we want is for the writes to go to the master, and the reads to go to the slaves. I have verified using tcpdump that no traffic is going to the load-balancer:3306 address, either when the proxy starts up or when clients actually start connecting to the proxy.
>
> I've dug into the code enough to prove that the proxy-read-only-backend-addresses parameter is actually being read, but it's been years since I've done any c, so am a bit behind in figuring out what is going on. Has anybody else seen this behavior? Known issue, or just silliness on my part that I've forgot something?
>
> Thanks,
> -ug
>
> You received this question notification because you are a member of
> MySQL Proxy Discuss, which is an answer contact for MySQL Proxy.
>

--
Diego Medina
Web Developer
http://www.fmpwizard.com

Revision history for this message
Ron Snyder (unixguy-orig) said :
#2

Thanks Diego. We're looking at other solutions, but it seems that there aren't a lot of easy answers to this problem.

Revision history for this message
Herve (hcayard) said :
#3

Hi Ron,

We have been trying to make the proxy works in that configuration but we haven´t succeded.
The rw-splitting.lua script doesn´t seem to work properly.
Please tell us if you are abble to make it work.

As you are, we are also looking for other solutions.
I do not know as far you have been investigating buy I could recomend you this post:
http://krow.livejournal.com/595518.html

Best regards.
Herve (from Madrid - Spain)