← Back to team overview

mysql-proxy-discuss team mailing list archive

Re: Choose which server to connect to

 

YES you understood ;-)

I can't add those hosts to my dns because they are in a sub-sub network on which I just want one machine
to access to it.

I'll try something else, and let you know if I manage.

Anyway, "MERDE" for mysqlproxy new coming release ;-)

----- Mail Original -----
De: "Joshua Zhu" <zhuzhaoyuan@xxxxxxxxx>
À: "Pierre" <mail@xxxxxxxx>
Cc: mysql-proxy-discuss@xxxxxxxxxxxxxxxxxxx
Envoyé: Mercredi 11 Février 2009 12h18:02 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [Mysql-proxy-discuss] Choose which server to connect to


I hope I've understood :) 


On Wed, Feb 11, 2009 at 5:49 PM, Pierre < mail@xxxxxxxx > wrote: 


Ok, let's restart from scratch: 


A client wants to connect to its mysql server. So he puts sql.client1.com . 
Let's say sql.client1.com is a CNAME to mysqlproxy.master.com OR a 'A' to mysql.proxy.ip.address . 

Another client would have the same configuration: sql.client2.com -> mysqlproxy.master.com (or mysql.proxy.ip.address). 

With a consequence, all clients requests are "redirected" to the proxy. 


Now, I still want different mysql server for my clients. For exemple: 
sql.client1.private.master.com 
sql.client2.private.master.com 


To do that, I would like to know if mysql proxy is able to tell me from which ip or address it has been called by. (sorry if the sentence is not correct) 

In other words, I would like the proxy to tell me: 
"Somebody called me using sql.client1.com " -> I would know it's client1's request, and I redirect it to sql.client1.private.master.com (or the equivalent ip) 

"Somebody called me using sql.client2.com " -> I would know it's client1's request, and I redirect it to sql.client2.private.master.com (or the equivalent ip) 


Eventually, the question is: 
Is mysqlproxy able to tell me the destination address of the requests, ie sql.client{1,2}.com ? 


No, MySQL Proxy does NOT know this kind of information. And actually it is not an issue of MySQL Proxy's , but TCP/IP's. That is to say, a server does not know the hostnames that its clients use to connect to, unless the hostnames are specified clearly in the protocol (e.g. HTTP). 

Possible solutions to your problem: 
1) Add more records in your DNS server, so you can redirect the clients to the right MySQL server, for example: 
mysql1.client1.com IN A 192.168.0.1 
mysql2.client2.com IN A 192.168.0.2 

So, the clients connect to mysql1.client1.com will be redirected to 192.168.0.1 (MySQL #1); the clients connect to mysql2.client1.com will be redirected to 192.168.0.2 (MySQL #2)... You don't need MySQL Proxy here, I think. 

2) Add the hostname as a hint in your SQLs, then parse and redirect it to the MySQL backend you want, using MySQL Proxy. 

I prefer solution 1. 

Regards! 

-- 
Joshua Zhu 
http://blog.zhuzhaoyuan.com 

_______________________________________________
Mailing list: https://launchpad.net/~mysql-proxy-discuss
Post to     : mysql-proxy-discuss@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~mysql-proxy-discuss
More help   : https://help.launchpad.net/ListHelp