[Sqlrelay-discussion] DB Routing based on user
Brought to you by:
mused
|
From: Carlos V. <cve...@em...> - 2010-02-25 17:19:01
|
Is it possible to route queries based on the username used to connect to the Router Instance?
For example, say I setup 2 users in the router instance. Is there a way to setup the route query pattern to check the user.
So all queries from routerUser1 go to db1 and all queries from routerUser2 go to db2, instead matching against the query themselves.
I ask because unlike the Documented example of db1 is mysql and db2 is postgre. I actually have 2 Sybase databases. I need another way to separate these queries other than regexing the query itself.
<instance id="router" port="9000" socket="/tmp/router.socket" dbase="router" connections="3" maxconnections="15">
<users>
<user user="routerUser1" password="routerpassword"/>
<user user="routerUser2" password="routerpassword"/>
</users>
<router>
<!-SOME HOW SEND ALL USER1 REQUESTS TO THIS DATABASE -->
<route host="" port="" socket="/tmp/Sybase1.socket" user=Sybase1dbuser" password="dbpassword">
<query pattern="+\smysqldb\."/>
<!-MAYBE SOMETHING LIKE THIS? -->
<query user="routerUser1">
</route>
<!-SOMEHOW SEND ALL USER2 REQUESTS TO THIS DATABASE -->
<route host="" port="" socket="/tmp/Sybase2.socket" user="Sybase2dbuser" password="dbpassword">
<query pattern="+\spostgresqldb\."/>
<!-MAYBE SOMETHING LIKE THIS? -->
<query user="routerUser2">
</route>
</router>
</instance>
|