phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Reid <gabriel.r...@gmail.com>
Subject Re: Phoenix Multitenancy - sqlline tenant-specific connection
Date Fri, 13 Mar 2015 07:11:59 GMT
The correct syntax for a Phoenix JDBC url with a tenant id is as follows:
localhost:2181;TenantId=foo

Note that the TenantId parameter is capitalized (it's case-sensitive).

However (on Linux or Mac at least), it's not currently possible to connect
with a tenant-specific connection like this, as the parameter handling done
in sqlline.py doesn't properly quote the full JDBC url. I've created
PHOENIX-1733 [1] to track this.

Once PHOENIX-1733 is resolved, you'll be able to connect as follows (note
the quotes around the connection string):

$ ./bin/sqlline.py 'localhost:2181:/hbase;TenantId=foo'

- Gabriel

1. https://issues.apache.org/jira/browse/PHOENIX-1733


On Fri, Mar 13, 2015 at 1:06 AM Nick Dimiduk <ndimiduk@gmail.com> wrote:

> This works fine for me:
>
> $ ./bin/sqlline.py localhost:2181:/hbase;tenantId=foo
>
> At least, it launches without complaint. I don't have any tables with
> tenants enabled.
>
>
> On Thu, Mar 12, 2015 at 4:48 PM, Vamsi Krishna <vamsi.attluri@gmail.com>
> wrote:
>
>> I got following error when I tried that:
>>
>> java -cp
>> "/etc/hbase/conf:/usr/hdp/2.2.0.0-2041/phoenix/bin/../phoenix-4.2.0.2.2.0.0-2041-client.jar"
>> -Dlog4j.configuration=file:/usr/hdp/2.2.0.0-2041/phoenix/bin/log4j.properties
>> sqlline.SqlLine -d org.apache.phoenix.jdbc.PhoenixDriver -u
>> jdbc:phoenix:localhost:2181:/hbase-unsecure;tenantid=abc -n none -p none
>> --color=true --fastConnect=false --verbose=true
>> --isolation=TRANSACTION_READ_COMMITTED
>>
>> 15/03/12 23:48:02 WARN impl.MetricsConfig: Cannot locate configuration:
>> tried hadoop-metrics2-phoenix.properties,hadoop-metrics2.properties
>>
>> Error:  (state=,code=0)
>>
>> sqlline version 1.1.2
>>
>> Vamsi Attluri.
>>
>> On Thu, Mar 12, 2015 at 4:00 PM, Nick Dimiduk <ndimiduk@gmail.com> wrote:
>>
>>> It looks like tenantId is passed on as a jdbc property. So I think
>>> localhost:2181:/hbase becomes localhost:2181:/hbase;tenantId=abc. At least
>>> that's what's happening in JDBCUtilTest.
>>>
>>> On Thu, Mar 12, 2015 at 3:24 PM, Vamsi Krishna <vamsi.attluri@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Can someone help me understand how to establish a tenant-specific
>>>> connection using Sqlline?
>>>>
>>>> I see the following documented on Phoenix website, but i'm not sure how
>>>> to do that for Sqlline connection:
>>>>
>>>> http://phoenix.apache.org/multi-tenancy.html
>>>>
>>>> For example, a tenant-specific connection is established like this:
>>>>
>>>> Properties props = new Properties();
>>>> props.setProperty("TenantId", "Acme");
>>>> Connection conn = DriverManager.getConnection("localhost", props);
>>>>
>>>> Thanks,
>>>> Vamsi Attluri.
>>>>
>>>
>>>
>>
>

Mime
View raw message