Re: [Sqlrelay-discussion] MySQL proxy
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2007-02-15 16:01:21
|
SQL Relay isn't really designed to do this exactly. There's a really round-about way to accomplish this with SQL Relay though. If you're using linux, you forward requests to the local machine to a remote machine using iptables port-forwarding much more easily. I believe a command like: iptables -t nat -A PREROUTING \ -p tcp -d "localip" --dport 3306 \ -j DNAT --to-destination "remoteip:":3306 should do it. Replace "localip" with the ip of the local machine and "remoteip" with the ip of the remote machine. You have to add a separate rule for each network interface (including localhost loopback). You could also use SQL Relay's drop-in replacement library for mysql with your app, run an instance of SQL Relay on port 3306 on the local machine and configure it to log into mysql on the remote machine and use authtier="database" with a dummy user. The config file would look like: <instances> <instance id="mysqltest" port="3306" ... authtier="database"> <users> <user user="dummy" password="dummy"/> </users> <connections> <connection connectionid="db" string="user=mysqluser;password=mydsqlpassword;host=remotehost" metric="1"/> </connections> </instance> </intances> This is much more round-about way of doing things though. David Muse dav...@fi... On Wed, 2007-02-14 at 00:45 +0100, Bertrand LUPART wrote: > Hello, > > I'm just trying to set up a simple MySQL proxy: all the request to > the local machine is to be forwarded to a remote one, > authentification should be done on the remote MySQL server. > > > The configuration i'm trying to set up is the following (0.38): > ----8<----8<----8<----8<---- > <?xml version="1.0"?> > <!DOCTYPE instances SYSTEM "sqlrelay.dtd"> > <instances> > <instance id="mysqltest" port="3306" socket="/var/run/mysqld/ > mysqld.sock" dbase="mysql" connections="3" maxconnections="5" > maxqueuelength="0" growby="1" ttl="60" endofsession="commit" > sessiontimeout="600" runasuser="" runasgroup="" cursors="5" > authtier="database" handoff="pass"> > <router> > <route host="my.remote.mysql.server" port="3306"> > <query pattern=".*"/> > </route> > </router> > </instance> > </instances> > ---->8---->8---->8---->8---- > > That's not correct, since users and connections elements are required > by the dtd. > > I'd just like to forward all the local connections to a remote host, > without dealing with users (i don't know all the login/passwords for > all users). Is that possible? > > Greetings, > |