Re: [Sqlrelay-discussion] Perl DBI API to connect to diferent db
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2006-01-03 19:35:37
|
When using multiple databases, SQL Relay assumes that the databases are
replicated copies of each other (or are nodes in a cluster) and
distributes client sessions over them to balance load.
I think you're looking for a query routing feature where the databases
aren't copies of each other, and SQL Relay can be configured to send
certain queries to 1 database and other queries to another.
SQL Relay doesn't currently support that feature, nor will it be
available in 0.37, but it will likely be available in 0.38.
In the mean time if you want to send one set of queries to one database
and another set to a second database, you'll have to set up 2 instances
of SQL Relay and your application will have to choose which instance to
run the query though.
David Muse
dav...@fi...
On Wed, 2005-12-14 at 20:13 +0100, Albert Vila wrote:
> Hi all,
>
> I've just downloaded and tried the sqlrelay application. It looks
> great, however, I have a problem trying to connect using more than one db.
>
> I have the following conf:
>
> <instances>
> <instance id="example" port="9000" socket="/tmp/example.socket"
> dbase="mysql" connections="3" maxconnections="15" maxqueuelength="5"
> growby="1" ttl="60" endofsession="commit" sessiontimeout="600"
> runasuser="nobody" runasgroup="nobody" cursors="5" authtier="listener"
> handoff="pass" deniedips="" allowedips="" debug="listener_and_connection">
> <users>
> <user user="mysqltest" password="mysqltest"/>
> </users>
> <connections>
> <connection connectionid="db1"
> string="user=yyy;password=xxx;db=db1;host=myhost" metric="1"/>
> <connection connectionid="db2"
> string="user=yyy;password=xxx;db=db2;host=myhost" metric="1"/>
> </connections>
> </instance>
> </instances>
>
> And i'm using the dbi api this way:
>
> my
> $dbh=DBI->connect("DBI:SQLRelay:host=localhost;port=9000;socket=","mysqltest","mysqltest");
>
> The problem is how can I choose between one connection or another?
>
> For example, I have this two querys:
> select * from table_1 -> this query must run over the connectionid db1.
> select * from table_2 -> this query must run over the connectionid db2.
>
> I've not found the way to deal with this problem, because using
> DBI->connect method I cannot set the connectionid parameter. If I use
> the DBI->connect method, one query works fine and the other one not.
>
> Am I doing something wrong?
>
> Thanks in advance.
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Sqlrelay-discussion mailing list
> Sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
>
|