← Back to team overview

mysql-proxy-discuss team mailing list archive

Re: Simple proxy setup for application split read and writes

 

Hi!

On Jun 16, 2009, at 5:00 PM, Brian Zammit wrote:

Hello again list,

I want to use mysql-proxy to create a simple pair of proxy applications. One
for reads, one for writes that are split at the application level.

The write configuration is currently:
--daemon --proxy-skip-profiling --proxy-address=localhost:4040
--admin-address=localhost:4041 --proxy-backend- addresses=10.10.10.10:3306

The read configuration is currently:
--daemon --proxy-skip-profiling --proxy-address=localhost:4050
--admin-address=localhost:4051
--proxy-backend-addresses=10.10.10.20:3306--proxy-backend-addresses=
10.10.10.21:3306


I want the read servers to be load balanced, and have read servers
automatically fall out and rejoin the pool on failure/recovery. Does the
configuration above make sense, or should I be using --proxy-

read-only-backend-addresses for the read configuration to have this work
properly?

If you are using a lua script you can pick any backend (read/write or read-only) you like. The default implementation written in C will skip read-only backends when looking for a backend to connect to, because that's the most reasonable thing to do if we don't know what the connection will be used for (you don't want a slave being selected for a random client
that might want to write).

I think if you don't want to provide a script that implements connect_server and can ensure in the application level that no writes will be issued on slaves, then using
--proxy-backend-addresses is what you want.

Suggestions on the most convenient way to watch the queries flow through the
proxies to make sure queries are going where they should?


There are a couple of options for doing so:
You could use a lua table in proxy.global to track the number of queries send to a specific backend index,
or you could write that information to the log file.
If you choose the proxy.global table version, you would have to either add something to the admin script
to be able to query that information or log it in regular intervals.

Check out the tutorial-resultset.lua file for a simple example of the global counter version.

cheers,
-k
--
Kay Roepke
Software Engineer, MySQL Enterprise Tools

Sun Microsystems GmbH    Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer:    Thomas Schroeder,  Wolfang Engels,  Wolf Frenkel
Vorsitz d. Aufs.rat.: Martin Haering                    HRB MUC 161028




References