You cannot enforce that only one backend connection is created, as the proxy plugin does not do multiplexing. There is a bzr branch on the mysql-proxy launchpad project called 'funnel' which has a prototype multiplexer that can do what you require. Bear in mind that it has some caveats, such that it will not work with some workloads (transactions, queries relying on session state, etc etc), and is really only a 'prototype' although we use it in production.
Cheers On Wed, Jul 15, 2009 at 7:00 AM, Adrienne Porter Felt<[email protected]> wrote: > Hi - > I am trying to set up connection pooling such that 2 applications connect to > the proxy and share 1 actual connection to the database. I do this by > letting the first connection go through unaltered, and then setting the > second attempted connection to use the first connection. I don't want the > second connection to need to re-authenticate to the actual database, I just > want to send its queries out over the existing authenticated backend > connection. > I keep getting this error during read_query() when the second tries to use > the first connection: > 2009-07-14 19:30:10: (critical) proxy-plugin.c.1129: I have no server > backend, closing connection > 2009-07-14 19:30:10: (critical) network-mysqld.c.1188: > plugin_call(CON_STATE_READ_QUERY) failed > Here is my code: > if proxy.global.client_counter == nil then > proxy.global.client_counter = 0 > end > local proto = assert(require("mysql.proto")) > local order = 0 > function connect_server() > proxy.global.client_counter = proxy.global.client_counter + 1 > order = proxy.global.client_counter > if order ~= 1 then > proxy.response = { > type = proxy.MYSQLD_PACKET_RAW, > packets = { > proto.to_challenge_packet({ > server_status = 2, > server_version = 50132, > thread_id = 12345678922222 > }) > } > } > return proxy.PROXY_SEND_RESULT > end > end > function read_query(stmt) > if order ~= 1 then > proxy.connection.backend_ndx = 1 > return proxy.PROXY_SEND_QUERY > end > end > What am I doing wrong? And FYI I am using 0.7.2. > Thanks much for the help. > _______________________________________________ > Mailing list: https://launchpad.net/~mysql-proxy-discuss > Post to : [email protected] > Unsubscribe : https://launchpad.net/~mysql-proxy-discuss > More help : https://help.launchpad.net/ListHelp > > -- Nick Loeve _______________________________________________ Mailing list: https://launchpad.net/~mysql-proxy-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~mysql-proxy-discuss More help : https://help.launchpad.net/ListHelp

