You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Cui Lin <ic...@gmail.com> on 2016/12/16 18:29:30 UTC

Phoenix database adapter for Python not working

I followed the instruction from
http://python-phoenixdb.readthedocs.io/en/latest/

to connect Hbase in cloudera cluster, but I got the following error below.


>>> import phoenixdb
>>> database_url = 'http://localhost:8765/'
>>> conn = phoenixdb.connect(database_url, autocommit=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py",
line 63, in connect
client.connect()
File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py",
line 152, in connect
raise errors.InterfaceError('Unable to connect to the specified service', e)
phoenixdb.errors.InterfaceError: ('Unable to connect to the specified
service', error(111, 'Connection refused'), None, None)


I can create table using phoenix-sqlline.py localhost:2181:/hbase or even
use ./psql.py to import CSV, why the python adaopter does not work? Could
someone give me a simple example that allows the adapter to connect Hbase
in Cloudera?

I've been trying to find the solution for days... please help!


--
Best regards!

Lin,Cui

Re: Phoenix database adapter for Python not working

Posted by Cui Lin <ic...@gmail.com>.
Thanks, Mark, I missed that. The article is helpful!

On Fri, Dec 16, 2016 at 11:16 AM, Mark Heppner <he...@gmail.com>
wrote:

> There are full instructions on the docs about the query server and config
> options:
>     https://phoenix.apache.org/server.html
>
>
> On Fri, Dec 16, 2016 at 2:10 PM, Cui Lin <ic...@gmail.com> wrote:
>
>> Hello, Will,
>>
>> I was hopeless for couple of days on this, and you are my life saver!
>> It works by starting the query server. it is working on both my cloudera
>> cluster and standalone hbase clusters.
>>
>> I haven't seen any instructions on starting the query server. This is
>> indeed a critical procedure!
>> Thanks a million for your help!!!
>>
>> On Fri, Dec 16, 2016 at 10:55 AM, Will Xu <wx...@hortonworks.com> wrote:
>>
>>> Hmm, maybe the e-mail earlier didn't go through...
>>>
>>> Connection error at :8765, this means you probably don't have Phoenix
>>> query server started.
>>> I'm not a cloudera distro expert, but I assume you can locate this file
>>> "queryserver.py"
>>>
>>> Run
>>> $>sudo ./queryserver.py start
>>>
>>> And try curl again.
>>>
>>> For more details:
>>> https://phoenix.apache.org/server.html​
>>>
>>> Phoenix and Phoenix query server are 2 different things.
>>>
>>> Think Phoenix query server as a phoenix client. sqlline-thin depends on
>>> phoenix query server.  sqlline depends on Phoenix.
>>> ​
>>> Thus, when you use sqlline, you connect to zk node, which is zk:2181 and
>>> when you use sqlline-thin (or python client), you connect to phoenix query
>>> server, which usually sits at 8765.
>>>
>>> Regards,
>>> Will
>>>
>>>
>>> ------------------------------
>>> *From:* Cui Lin <ic...@gmail.com>
>>> *Sent:* Friday, December 16, 2016 10:47 AM
>>> *To:* user@phoenix.apache.org
>>> *Subject:* Re: Phoenix database adapter for Python not working
>>>
>>>  pip freeze | grep phoenixdb
>>> phoenixdb==0.5
>>>
>>> so the connector's version is right.
>>>
>>> On Fri, Dec 16, 2016 at 10:46 AM, Cui Lin <ic...@gmail.com>
>>> wrote:
>>>
>>>> sqlline-thin.py does not work either. Did I have anything missing? I
>>>> can run
>>>> /sqlline.py localhost:2181:hbase without any problem.
>>>>
>>>>
>>>>
>>>> # ./sqlline-thin.py http://localhost:8765
>>>> Failed to find hbase executable on PATH, defaulting serialization to
>>>> PROTOBUF.
>>>> Setting property: [incremental, false]
>>>> Setting property: [isolation, TRANSACTION_READ_COMMITTED]
>>>> issuing: !connect jdbc:phoenix:thin:url=http://l
>>>> ocalhost:8765;serialization=PROTOBUF none none
>>>> org.apache.phoenix.queryserver.client.Driver
>>>> Connecting to jdbc:phoenix:thin:url=http://l
>>>> ocalhost:8765;serialization=PROTOBUF
>>>> java.lang.RuntimeException: org.apache.calcite.avatica.org
>>>> .apache.http.conn.HttpHostConnectException: Connect to localhost:8765
>>>> [localhost/127.0.0.1] failed: Connection refused (Connection refused)
>>>> at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientIm
>>>> pl.send(AvaticaCommonsHttpClientImpl.java:143)
>>>> at org.apache.calcite.avatica.remote.RemoteProtobufService._app
>>>> ly(RemoteProtobufService.java:44)
>>>> at org.apache.calcite.avatica.remote.ProtobufService.apply(Prot
>>>> obufService.java:81)
>>>> at org.apache.calcite.avatica.remote.Driver.connect(Driver.java:175)
>>>> at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
>>>> at sqlline.DatabaseConnection.getConnection(DatabaseConnection.
>>>> java:203)
>>>> at sqlline.Commands.connect(Commands.java:1064)
>>>> at sqlline.Commands.connect(Commands.java:996)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>>>> ssorImpl.java:62)
>>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>>> thodAccessorImpl.java:43)
>>>> at java.lang.reflect.Method.invoke(Method.java:498)
>>>> at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHa
>>>> ndler.java:36)
>>>> at sqlline.SqlLine.dispatch(SqlLine.java:803)
>>>> at sqlline.SqlLine.initArgs(SqlLine.java:588)
>>>> at sqlline.SqlLine.begin(SqlLine.java:656)
>>>> at sqlline.SqlLine.start(SqlLine.java:398)
>>>> at sqlline.SqlLine.main(SqlLine.java:292)
>>>> at org.apache.phoenix.queryserver.client.SqllineWrapper.main(Sq
>>>> llineWrapper.java:83)
>>>> Caused by: org.apache.calcite.avatica.org.apache.http.conn.HttpHostConnectException:
>>>> Connect to localhost:8765 [localhost/127.0.0.1] failed: Connection
>>>> refused (Connection refused)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.conn.Default
>>>> HttpClientConnectionOperator.connect(DefaultHttpClientConnec
>>>> tionOperator.java:158)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.conn.Pooling
>>>> HttpClientConnectionManager.connect(PoolingHttpClientConnect
>>>> ionManager.java:353)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Ma
>>>> inClientExec.establishRoute(MainClientExec.java:380)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Ma
>>>> inClientExec.execute(MainClientExec.java:236)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Pr
>>>> otocolExec.execute(ProtocolExec.java:184)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Re
>>>> tryExec.execute(RetryExec.java:88)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Re
>>>> directExec.execute(RedirectExec.java:110)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.client.Inter
>>>> nalHttpClient.doExecute(InternalHttpClient.java:184)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.client.Close
>>>> ableHttpClient.execute(CloseableHttpClient.java:82)
>>>> at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientIm
>>>> pl.send(AvaticaCommonsHttpClientImpl.java:131)
>>>> ... 18 more
>>>> Caused by: java.net.ConnectException: Connection refused (Connection
>>>> refused)
>>>> at java.net.PlainSocketImpl.socketConnect(Native Method)
>>>> at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSock
>>>> etImpl.java:350)
>>>> at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPl
>>>> ainSocketImpl.java:206)
>>>> at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocket
>>>> Impl.java:188)
>>>> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
>>>> at java.net.Socket.connect(Socket.java:589)
>>>> at org.apache.calcite.avatica.org.apache.http.conn.socket.Plain
>>>> ConnectionSocketFactory.connectSocket(PlainConnectionSocketF
>>>> actory.java:74)
>>>> at org.apache.calcite.avatica.org.apache.http.impl.conn.Default
>>>> HttpClientConnectionOperator.connect(DefaultHttpClientConnec
>>>> tionOperator.java:141)
>>>> ... 27 more
>>>> sqlline version 1.1.9
>>>> 0: jdbc:phoenix:thin:url=http://localhost:876>
>>>>
>>>> On Fri, Dec 16, 2016 at 10:42 AM, Cui Lin <ic...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Will,
>>>>>
>>>>>  curl http://localhost:8765
>>>>> curl: (7) Failed to connect to localhost port 8765: Connection refused
>>>>>
>>>>> How I open this connection?
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Dec 16, 2016 at 10:38 AM, Will Xu <wx...@hortonworks.com> wrote:
>>>>>
>>>>>> A few things.
>>>>>>
>>>>>> 1. Are you on 0.5 version of the connector?
>>>>>>
>>>>>> $>pip freeze | grep phoenixdb
>>>>>>
>>>>>> Should be==> phoenixdb==0.5
>>>>>>
>>>>>>
>>>>>> 2. Can you try curl http://localhost:8765 to see if the server is
>>>>>> actually running? If you open the page in browser you should see a Jetty
>>>>>> 404 page.
>>>>>>
>>>>>>
>>>>>> PQS is a think wrapper around Phoenix client. It's actually a
>>>>>> service. If you have sqlline-thin client you can test it out.
>>>>>>
>>>>>> $>bin/sqlline-thin.py http://localhost:8765
>>>>>>
>>>>>> Regards,
>>>>>> Will
>>>>>> ------------------------------
>>>>>> *From:* Cui Lin <ic...@gmail.com>
>>>>>> *Sent:* Friday, December 16, 2016 10:29 AM
>>>>>> *To:* user@phoenix.apache.org
>>>>>> *Subject:* Phoenix database adapter for Python not working
>>>>>>
>>>>>> I followed the instruction from http://python-phoenixdb.readth
>>>>>> edocs.io/en/latest/
>>>>>>
>>>>>> to connect Hbase in cloudera cluster, but I got the following error
>>>>>> below.
>>>>>>
>>>>>>
>>>>>> >>> import phoenixdb
>>>>>> >>> database_url = 'http://localhost:8765/'
>>>>>> >>> conn = phoenixdb.connect(database_url, autocommit=True)
>>>>>> Traceback (most recent call last):
>>>>>> File "<stdin>", line 1, in <module>
>>>>>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py",
>>>>>> line 63, in connect
>>>>>> client.connect()
>>>>>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py",
>>>>>> line 152, in connect
>>>>>> raise errors.InterfaceError('Unable to connect to the specified
>>>>>> service', e)
>>>>>> phoenixdb.errors.InterfaceError: ('Unable to connect to the
>>>>>> specified service', error(111, 'Connection refused'), None, None)
>>>>>>
>>>>>>
>>>>>> I can create table using phoenix-sqlline.py localhost:2181:/hbase or
>>>>>> even use ./psql.py to import CSV, why the python adaopter does not work?
>>>>>> Could someone give me a simple example that allows the adapter to connect
>>>>>> Hbase in Cloudera?
>>>>>>
>>>>>> I've been trying to find the solution for days... please help!
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best regards!
>>>>>>
>>>>>> Lin,Cui
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best regards!
>>>>>
>>>>> Lin,Cui
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards!
>>>>
>>>> Lin,Cui
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards!
>>>
>>> Lin,Cui
>>>
>>
>>
>>
>> --
>> Best regards!
>>
>> Lin,Cui
>>
>
>
>
> --
> Mark Heppner
>



-- 
Best regards!

Lin,Cui

Re: Phoenix database adapter for Python not working

Posted by Mark Heppner <he...@gmail.com>.
There are full instructions on the docs about the query server and config
options:
    https://phoenix.apache.org/server.html


On Fri, Dec 16, 2016 at 2:10 PM, Cui Lin <ic...@gmail.com> wrote:

> Hello, Will,
>
> I was hopeless for couple of days on this, and you are my life saver!
> It works by starting the query server. it is working on both my cloudera
> cluster and standalone hbase clusters.
>
> I haven't seen any instructions on starting the query server. This is
> indeed a critical procedure!
> Thanks a million for your help!!!
>
> On Fri, Dec 16, 2016 at 10:55 AM, Will Xu <wx...@hortonworks.com> wrote:
>
>> Hmm, maybe the e-mail earlier didn't go through...
>>
>> Connection error at :8765, this means you probably don't have Phoenix
>> query server started.
>> I'm not a cloudera distro expert, but I assume you can locate this file
>> "queryserver.py"
>>
>> Run
>> $>sudo ./queryserver.py start
>>
>> And try curl again.
>>
>> For more details:
>> https://phoenix.apache.org/server.html​
>>
>> Phoenix and Phoenix query server are 2 different things.
>>
>> Think Phoenix query server as a phoenix client. sqlline-thin depends on
>> phoenix query server.  sqlline depends on Phoenix.
>> ​
>> Thus, when you use sqlline, you connect to zk node, which is zk:2181 and
>> when you use sqlline-thin (or python client), you connect to phoenix query
>> server, which usually sits at 8765.
>>
>> Regards,
>> Will
>>
>>
>> ------------------------------
>> *From:* Cui Lin <ic...@gmail.com>
>> *Sent:* Friday, December 16, 2016 10:47 AM
>> *To:* user@phoenix.apache.org
>> *Subject:* Re: Phoenix database adapter for Python not working
>>
>>  pip freeze | grep phoenixdb
>> phoenixdb==0.5
>>
>> so the connector's version is right.
>>
>> On Fri, Dec 16, 2016 at 10:46 AM, Cui Lin <ic...@gmail.com>
>> wrote:
>>
>>> sqlline-thin.py does not work either. Did I have anything missing? I can
>>> run
>>> /sqlline.py localhost:2181:hbase without any problem.
>>>
>>>
>>>
>>> # ./sqlline-thin.py http://localhost:8765
>>> Failed to find hbase executable on PATH, defaulting serialization to
>>> PROTOBUF.
>>> Setting property: [incremental, false]
>>> Setting property: [isolation, TRANSACTION_READ_COMMITTED]
>>> issuing: !connect jdbc:phoenix:thin:url=http://l
>>> ocalhost:8765;serialization=PROTOBUF none none
>>> org.apache.phoenix.queryserver.client.Driver
>>> Connecting to jdbc:phoenix:thin:url=http://l
>>> ocalhost:8765;serialization=PROTOBUF
>>> java.lang.RuntimeException: org.apache.calcite.avatica.org
>>> .apache.http.conn.HttpHostConnectException: Connect to localhost:8765
>>> [localhost/127.0.0.1] failed: Connection refused (Connection refused)
>>> at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientIm
>>> pl.send(AvaticaCommonsHttpClientImpl.java:143)
>>> at org.apache.calcite.avatica.remote.RemoteProtobufService._app
>>> ly(RemoteProtobufService.java:44)
>>> at org.apache.calcite.avatica.remote.ProtobufService.apply(Prot
>>> obufService.java:81)
>>> at org.apache.calcite.avatica.remote.Driver.connect(Driver.java:175)
>>> at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
>>> at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)
>>> at sqlline.Commands.connect(Commands.java:1064)
>>> at sqlline.Commands.connect(Commands.java:996)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>>> ssorImpl.java:62)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>> thodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:498)
>>> at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHa
>>> ndler.java:36)
>>> at sqlline.SqlLine.dispatch(SqlLine.java:803)
>>> at sqlline.SqlLine.initArgs(SqlLine.java:588)
>>> at sqlline.SqlLine.begin(SqlLine.java:656)
>>> at sqlline.SqlLine.start(SqlLine.java:398)
>>> at sqlline.SqlLine.main(SqlLine.java:292)
>>> at org.apache.phoenix.queryserver.client.SqllineWrapper.main(Sq
>>> llineWrapper.java:83)
>>> Caused by: org.apache.calcite.avatica.org.apache.http.conn.HttpHostConnectException:
>>> Connect to localhost:8765 [localhost/127.0.0.1] failed: Connection
>>> refused (Connection refused)
>>> at org.apache.calcite.avatica.org.apache.http.impl.conn.Default
>>> HttpClientConnectionOperator.connect(DefaultHttpClientConnec
>>> tionOperator.java:158)
>>> at org.apache.calcite.avatica.org.apache.http.impl.conn.Pooling
>>> HttpClientConnectionManager.connect(PoolingHttpClientConnect
>>> ionManager.java:353)
>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Ma
>>> inClientExec.establishRoute(MainClientExec.java:380)
>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Ma
>>> inClientExec.execute(MainClientExec.java:236)
>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Pr
>>> otocolExec.execute(ProtocolExec.java:184)
>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Re
>>> tryExec.execute(RetryExec.java:88)
>>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.Re
>>> directExec.execute(RedirectExec.java:110)
>>> at org.apache.calcite.avatica.org.apache.http.impl.client.Inter
>>> nalHttpClient.doExecute(InternalHttpClient.java:184)
>>> at org.apache.calcite.avatica.org.apache.http.impl.client.Close
>>> ableHttpClient.execute(CloseableHttpClient.java:82)
>>> at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientIm
>>> pl.send(AvaticaCommonsHttpClientImpl.java:131)
>>> ... 18 more
>>> Caused by: java.net.ConnectException: Connection refused (Connection
>>> refused)
>>> at java.net.PlainSocketImpl.socketConnect(Native Method)
>>> at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSock
>>> etImpl.java:350)
>>> at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPl
>>> ainSocketImpl.java:206)
>>> at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocket
>>> Impl.java:188)
>>> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
>>> at java.net.Socket.connect(Socket.java:589)
>>> at org.apache.calcite.avatica.org.apache.http.conn.socket.Plain
>>> ConnectionSocketFactory.connectSocket(PlainConnectionSocketF
>>> actory.java:74)
>>> at org.apache.calcite.avatica.org.apache.http.impl.conn.Default
>>> HttpClientConnectionOperator.connect(DefaultHttpClientConnec
>>> tionOperator.java:141)
>>> ... 27 more
>>> sqlline version 1.1.9
>>> 0: jdbc:phoenix:thin:url=http://localhost:876>
>>>
>>> On Fri, Dec 16, 2016 at 10:42 AM, Cui Lin <ic...@gmail.com>
>>> wrote:
>>>
>>>> Hi Will,
>>>>
>>>>  curl http://localhost:8765
>>>> curl: (7) Failed to connect to localhost port 8765: Connection refused
>>>>
>>>> How I open this connection?
>>>>
>>>>
>>>>
>>>> On Fri, Dec 16, 2016 at 10:38 AM, Will Xu <wx...@hortonworks.com> wrote:
>>>>
>>>>> A few things.
>>>>>
>>>>> 1. Are you on 0.5 version of the connector?
>>>>>
>>>>> $>pip freeze | grep phoenixdb
>>>>>
>>>>> Should be==> phoenixdb==0.5
>>>>>
>>>>>
>>>>> 2. Can you try curl http://localhost:8765 to see if the server is
>>>>> actually running? If you open the page in browser you should see a Jetty
>>>>> 404 page.
>>>>>
>>>>>
>>>>> PQS is a think wrapper around Phoenix client. It's actually a service.
>>>>> If you have sqlline-thin client you can test it out.
>>>>>
>>>>> $>bin/sqlline-thin.py http://localhost:8765
>>>>>
>>>>> Regards,
>>>>> Will
>>>>> ------------------------------
>>>>> *From:* Cui Lin <ic...@gmail.com>
>>>>> *Sent:* Friday, December 16, 2016 10:29 AM
>>>>> *To:* user@phoenix.apache.org
>>>>> *Subject:* Phoenix database adapter for Python not working
>>>>>
>>>>> I followed the instruction from http://python-phoenixdb.readth
>>>>> edocs.io/en/latest/
>>>>>
>>>>> to connect Hbase in cloudera cluster, but I got the following error
>>>>> below.
>>>>>
>>>>>
>>>>> >>> import phoenixdb
>>>>> >>> database_url = 'http://localhost:8765/'
>>>>> >>> conn = phoenixdb.connect(database_url, autocommit=True)
>>>>> Traceback (most recent call last):
>>>>> File "<stdin>", line 1, in <module>
>>>>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py",
>>>>> line 63, in connect
>>>>> client.connect()
>>>>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py",
>>>>> line 152, in connect
>>>>> raise errors.InterfaceError('Unable to connect to the specified
>>>>> service', e)
>>>>> phoenixdb.errors.InterfaceError: ('Unable to connect to the specified
>>>>> service', error(111, 'Connection refused'), None, None)
>>>>>
>>>>>
>>>>> I can create table using phoenix-sqlline.py localhost:2181:/hbase or
>>>>> even use ./psql.py to import CSV, why the python adaopter does not work?
>>>>> Could someone give me a simple example that allows the adapter to connect
>>>>> Hbase in Cloudera?
>>>>>
>>>>> I've been trying to find the solution for days... please help!
>>>>>
>>>>>
>>>>> --
>>>>> Best regards!
>>>>>
>>>>> Lin,Cui
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards!
>>>>
>>>> Lin,Cui
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards!
>>>
>>> Lin,Cui
>>>
>>
>>
>>
>> --
>> Best regards!
>>
>> Lin,Cui
>>
>
>
>
> --
> Best regards!
>
> Lin,Cui
>



-- 
Mark Heppner

Re: Phoenix database adapter for Python not working

Posted by Cui Lin <ic...@gmail.com>.
Hello, Will,

I was hopeless for couple of days on this, and you are my life saver!
It works by starting the query server. it is working on both my cloudera
cluster and standalone hbase clusters.

I haven't seen any instructions on starting the query server. This is
indeed a critical procedure!
Thanks a million for your help!!!

On Fri, Dec 16, 2016 at 10:55 AM, Will Xu <wx...@hortonworks.com> wrote:

> Hmm, maybe the e-mail earlier didn't go through...
>
> Connection error at :8765, this means you probably don't have Phoenix
> query server started.
> I'm not a cloudera distro expert, but I assume you can locate this file
> "queryserver.py"
>
> Run
> $>sudo ./queryserver.py start
>
> And try curl again.
>
> For more details:
> https://phoenix.apache.org/server.html​
>
> Phoenix and Phoenix query server are 2 different things.
>
> Think Phoenix query server as a phoenix client. sqlline-thin depends on
> phoenix query server.  sqlline depends on Phoenix.
> ​
> Thus, when you use sqlline, you connect to zk node, which is zk:2181 and
> when you use sqlline-thin (or python client), you connect to phoenix query
> server, which usually sits at 8765.
>
> Regards,
> Will
>
>
> ------------------------------
> *From:* Cui Lin <ic...@gmail.com>
> *Sent:* Friday, December 16, 2016 10:47 AM
> *To:* user@phoenix.apache.org
> *Subject:* Re: Phoenix database adapter for Python not working
>
>  pip freeze | grep phoenixdb
> phoenixdb==0.5
>
> so the connector's version is right.
>
> On Fri, Dec 16, 2016 at 10:46 AM, Cui Lin <ic...@gmail.com> wrote:
>
>> sqlline-thin.py does not work either. Did I have anything missing? I can
>> run
>> /sqlline.py localhost:2181:hbase without any problem.
>>
>>
>>
>> # ./sqlline-thin.py http://localhost:8765
>> Failed to find hbase executable on PATH, defaulting serialization to
>> PROTOBUF.
>> Setting property: [incremental, false]
>> Setting property: [isolation, TRANSACTION_READ_COMMITTED]
>> issuing: !connect jdbc:phoenix:thin:url=http://l
>> ocalhost:8765;serialization=PROTOBUF none none
>> org.apache.phoenix.queryserver.client.Driver
>> Connecting to jdbc:phoenix:thin:url=http://l
>> ocalhost:8765;serialization=PROTOBUF
>> java.lang.RuntimeException: org.apache.calcite.avatica.org
>> .apache.http.conn.HttpHostConnectException: Connect to localhost:8765
>> [localhost/127.0.0.1] failed: Connection refused (Connection refused)
>> at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientIm
>> pl.send(AvaticaCommonsHttpClientImpl.java:143)
>> at org.apache.calcite.avatica.remote.RemoteProtobufService._app
>> ly(RemoteProtobufService.java:44)
>> at org.apache.calcite.avatica.remote.ProtobufService.apply(Prot
>> obufService.java:81)
>> at org.apache.calcite.avatica.remote.Driver.connect(Driver.java:175)
>> at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
>> at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)
>> at sqlline.Commands.connect(Commands.java:1064)
>> at sqlline.Commands.connect(Commands.java:996)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>> ssorImpl.java:62)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>> thodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:498)
>> at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHa
>> ndler.java:36)
>> at sqlline.SqlLine.dispatch(SqlLine.java:803)
>> at sqlline.SqlLine.initArgs(SqlLine.java:588)
>> at sqlline.SqlLine.begin(SqlLine.java:656)
>> at sqlline.SqlLine.start(SqlLine.java:398)
>> at sqlline.SqlLine.main(SqlLine.java:292)
>> at org.apache.phoenix.queryserver.client.SqllineWrapper.main(Sq
>> llineWrapper.java:83)
>> Caused by: org.apache.calcite.avatica.org.apache.http.conn.HttpHostConnectException:
>> Connect to localhost:8765 [localhost/127.0.0.1] failed: Connection
>> refused (Connection refused)
>> at org.apache.calcite.avatica.org.apache.http.impl.conn.Default
>> HttpClientConnectionOperator.connect(DefaultHttpClientConne
>> ctionOperator.java:158)
>> at org.apache.calcite.avatica.org.apache.http.impl.conn.Pooling
>> HttpClientConnectionManager.connect(PoolingHttpClientConne
>> ctionManager.java:353)
>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.
>> MainClientExec.establishRoute(MainClientExec.java:380)
>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.
>> MainClientExec.execute(MainClientExec.java:236)
>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.
>> ProtocolExec.execute(ProtocolExec.java:184)
>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.
>> RetryExec.execute(RetryExec.java:88)
>> at org.apache.calcite.avatica.org.apache.http.impl.execchain.
>> RedirectExec.execute(RedirectExec.java:110)
>> at org.apache.calcite.avatica.org.apache.http.impl.client.Inter
>> nalHttpClient.doExecute(InternalHttpClient.java:184)
>> at org.apache.calcite.avatica.org.apache.http.impl.client.Close
>> ableHttpClient.execute(CloseableHttpClient.java:82)
>> at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientIm
>> pl.send(AvaticaCommonsHttpClientImpl.java:131)
>> ... 18 more
>> Caused by: java.net.ConnectException: Connection refused (Connection
>> refused)
>> at java.net.PlainSocketImpl.socketConnect(Native Method)
>> at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSock
>> etImpl.java:350)
>> at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPl
>> ainSocketImpl.java:206)
>> at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocket
>> Impl.java:188)
>> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
>> at java.net.Socket.connect(Socket.java:589)
>> at org.apache.calcite.avatica.org.apache.http.conn.socket.Plain
>> ConnectionSocketFactory.connectSocket(PlainConnectionSocketF
>> actory.java:74)
>> at org.apache.calcite.avatica.org.apache.http.impl.conn.Default
>> HttpClientConnectionOperator.connect(DefaultHttpClientConne
>> ctionOperator.java:141)
>> ... 27 more
>> sqlline version 1.1.9
>> 0: jdbc:phoenix:thin:url=http://localhost:876>
>>
>> On Fri, Dec 16, 2016 at 10:42 AM, Cui Lin <ic...@gmail.com>
>> wrote:
>>
>>> Hi Will,
>>>
>>>  curl http://localhost:8765
>>> curl: (7) Failed to connect to localhost port 8765: Connection refused
>>>
>>> How I open this connection?
>>>
>>>
>>>
>>> On Fri, Dec 16, 2016 at 10:38 AM, Will Xu <wx...@hortonworks.com> wrote:
>>>
>>>> A few things.
>>>>
>>>> 1. Are you on 0.5 version of the connector?
>>>>
>>>> $>pip freeze | grep phoenixdb
>>>>
>>>> Should be==> phoenixdb==0.5
>>>>
>>>>
>>>> 2. Can you try curl http://localhost:8765 to see if the server is
>>>> actually running? If you open the page in browser you should see a Jetty
>>>> 404 page.
>>>>
>>>>
>>>> PQS is a think wrapper around Phoenix client. It's actually a service.
>>>> If you have sqlline-thin client you can test it out.
>>>>
>>>> $>bin/sqlline-thin.py http://localhost:8765
>>>>
>>>> Regards,
>>>> Will
>>>> ------------------------------
>>>> *From:* Cui Lin <ic...@gmail.com>
>>>> *Sent:* Friday, December 16, 2016 10:29 AM
>>>> *To:* user@phoenix.apache.org
>>>> *Subject:* Phoenix database adapter for Python not working
>>>>
>>>> I followed the instruction from http://python-phoenixdb.readth
>>>> edocs.io/en/latest/
>>>>
>>>> to connect Hbase in cloudera cluster, but I got the following error
>>>> below.
>>>>
>>>>
>>>> >>> import phoenixdb
>>>> >>> database_url = 'http://localhost:8765/'
>>>> >>> conn = phoenixdb.connect(database_url, autocommit=True)
>>>> Traceback (most recent call last):
>>>> File "<stdin>", line 1, in <module>
>>>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py",
>>>> line 63, in connect
>>>> client.connect()
>>>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py",
>>>> line 152, in connect
>>>> raise errors.InterfaceError('Unable to connect to the specified
>>>> service', e)
>>>> phoenixdb.errors.InterfaceError: ('Unable to connect to the specified
>>>> service', error(111, 'Connection refused'), None, None)
>>>>
>>>>
>>>> I can create table using phoenix-sqlline.py localhost:2181:/hbase or
>>>> even use ./psql.py to import CSV, why the python adaopter does not work?
>>>> Could someone give me a simple example that allows the adapter to connect
>>>> Hbase in Cloudera?
>>>>
>>>> I've been trying to find the solution for days... please help!
>>>>
>>>>
>>>> --
>>>> Best regards!
>>>>
>>>> Lin,Cui
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards!
>>>
>>> Lin,Cui
>>>
>>
>>
>>
>> --
>> Best regards!
>>
>> Lin,Cui
>>
>
>
>
> --
> Best regards!
>
> Lin,Cui
>



-- 
Best regards!

Lin,Cui

Re: Phoenix database adapter for Python not working

Posted by Will Xu <wx...@hortonworks.com>.
Hmm, maybe the e-mail earlier didn't go through...

Connection error at :8765, this means you probably don't have Phoenix query server started.
I'm not a cloudera distro expert, but I assume you can locate this file "queryserver.py"

Run
$>sudo ./queryserver.py start

And try curl again.

For more details:
https://phoenix.apache.org/server.html​

Phoenix and Phoenix query server are 2 different things.

Think Phoenix query server as a phoenix client. sqlline-thin depends on phoenix query server.  sqlline depends on Phoenix.
​
Thus, when you use sqlline, you connect to zk node, which is zk:2181 and when you use sqlline-thin (or python client), you connect to phoenix query server, which usually sits at 8765.

Regards,
Will


________________________________
From: Cui Lin <ic...@gmail.com>
Sent: Friday, December 16, 2016 10:47 AM
To: user@phoenix.apache.org
Subject: Re: Phoenix database adapter for Python not working

 pip freeze | grep phoenixdb
phoenixdb==0.5

so the connector's version is right.

On Fri, Dec 16, 2016 at 10:46 AM, Cui Lin <ic...@gmail.com>> wrote:
sqlline-thin.py does not work either. Did I have anything missing? I can run
/sqlline.py localhost:2181:hbase without any problem.



# ./sqlline-thin.py http://localhost:8765
Failed to find hbase executable on PATH, defaulting serialization to PROTOBUF.
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:thin:url=http://localhost:8765;serialization=PROTOBUF none none org.apache.phoenix.queryserver.client.Driver
Connecting to jdbc:phoenix:thin:url=http://localhost:8765;serialization=PROTOBUF
java.lang.RuntimeException: org.apache.calcite.avatica.org.apache.http.conn.HttpHostConnectException: Connect to localhost:8765 [localhost/127.0.0.1<http://127.0.0.1>] failed: Connection refused (Connection refused)
at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientImpl.send(AvaticaCommonsHttpClientImpl.java:143)
at org.apache.calcite.avatica.remote.RemoteProtobufService._apply(RemoteProtobufService.java:44)
at org.apache.calcite.avatica.remote.ProtobufService.apply(ProtobufService.java:81)
at org.apache.calcite.avatica.remote.Driver.connect(Driver.java:175)
at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)
at sqlline.Commands.connect(Commands.java:1064)
at sqlline.Commands.connect(Commands.java:996)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)
at sqlline.SqlLine.dispatch(SqlLine.java:803)
at sqlline.SqlLine.initArgs(SqlLine.java:588)
at sqlline.SqlLine.begin(SqlLine.java:656)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:292)
at org.apache.phoenix.queryserver.client.SqllineWrapper.main(SqllineWrapper.java:83)
Caused by: org.apache.calcite.avatica.org.apache.http.conn.HttpHostConnectException: Connect to localhost:8765 [localhost/127.0.0.1<http://127.0.0.1>] failed: Connection refused (Connection refused)
at org.apache.calcite.avatica.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)
at org.apache.calcite.avatica.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.calcite.avatica.org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.calcite.avatica.org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.calcite.avatica.org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.calcite.avatica.org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.calcite.avatica.org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.calcite.avatica.org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.calcite.avatica.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientImpl.send(AvaticaCommonsHttpClientImpl.java:131)
... 18 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net<http://java.net>.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net<http://java.net>.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net<http://java.net>.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.calcite.avatica.org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.calcite.avatica.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
... 27 more
sqlline version 1.1.9
0: jdbc:phoenix:thin:url=http://localhost:876>

On Fri, Dec 16, 2016 at 10:42 AM, Cui Lin <ic...@gmail.com>> wrote:
Hi Will,

 curl http://localhost:8765
curl: (7) Failed to connect to localhost port 8765: Connection refused

How I open this connection?



On Fri, Dec 16, 2016 at 10:38 AM, Will Xu <wx...@hortonworks.com>> wrote:

A few things.

1. Are you on 0.5 version of the connector?

$>pip freeze | grep phoenixdb

Should be==> phoenixdb==0.5


2. Can you try curl http://localhost:8765 to see if the server is actually running? If you open the page in browser you should see a Jetty 404 page.


PQS is a think wrapper around Phoenix client. It's actually a service. If you have sqlline-thin client you can test it out.

$>bin/sqlline-thin.py http://localhost:8765

Regards,
Will
________________________________
From: Cui Lin <ic...@gmail.com>>
Sent: Friday, December 16, 2016 10:29 AM
To: user@phoenix.apache.org<ma...@phoenix.apache.org>
Subject: Phoenix database adapter for Python not working

I followed the instruction from http://python-phoenixdb.readthedocs.io/en/latest/

to connect Hbase in cloudera cluster, but I got the following error below.


>>> import phoenixdb
>>> database_url = 'http://localhost:8765/'
>>> conn = phoenixdb.connect(database_url, autocommit=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py", line 63, in connect
client.connect()
File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py", line 152, in connect
raise errors.InterfaceError('Unable to connect to the specified service', e)
phoenixdb.errors.InterfaceError: ('Unable to connect to the specified service', error(111, 'Connection refused'), None, None)


I can create table using phoenix-sqlline.py localhost:2181:/hbase or even use ./psql.py to import CSV, why the python adaopter does not work? Could someone give me a simple example that allows the adapter to connect Hbase in Cloudera?

I've been trying to find the solution for days... please help!


--
Best regards!

Lin,Cui



--
Best regards!

Lin,Cui



--
Best regards!

Lin,Cui



--
Best regards!

Lin,Cui

Re: Phoenix database adapter for Python not working

Posted by Cui Lin <ic...@gmail.com>.
 pip freeze | grep phoenixdb
phoenixdb==0.5

so the connector's version is right.

On Fri, Dec 16, 2016 at 10:46 AM, Cui Lin <ic...@gmail.com> wrote:

> sqlline-thin.py does not work either. Did I have anything missing? I can
> run
> /sqlline.py localhost:2181:hbase without any problem.
>
>
>
> # ./sqlline-thin.py http://localhost:8765
> Failed to find hbase executable on PATH, defaulting serialization to
> PROTOBUF.
> Setting property: [incremental, false]
> Setting property: [isolation, TRANSACTION_READ_COMMITTED]
> issuing: !connect jdbc:phoenix:thin:url=http://
> localhost:8765;serialization=PROTOBUF none none org.apache.phoenix.
> queryserver.client.Driver
> Connecting to jdbc:phoenix:thin:url=http://localhost:8765;serialization=
> PROTOBUF
> java.lang.RuntimeException: org.apache.calcite.avatica.
> org.apache.http.conn.HttpHostConnectException: Connect to localhost:8765
> [localhost/127.0.0.1] failed: Connection refused (Connection refused)
> at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientImpl.send(
> AvaticaCommonsHttpClientImpl.java:143)
> at org.apache.calcite.avatica.remote.RemoteProtobufService._
> apply(RemoteProtobufService.java:44)
> at org.apache.calcite.avatica.remote.ProtobufService.apply(
> ProtobufService.java:81)
> at org.apache.calcite.avatica.remote.Driver.connect(Driver.java:175)
> at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
> at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)
> at sqlline.Commands.connect(Commands.java:1064)
> at sqlline.Commands.connect(Commands.java:996)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:
> 36)
> at sqlline.SqlLine.dispatch(SqlLine.java:803)
> at sqlline.SqlLine.initArgs(SqlLine.java:588)
> at sqlline.SqlLine.begin(SqlLine.java:656)
> at sqlline.SqlLine.start(SqlLine.java:398)
> at sqlline.SqlLine.main(SqlLine.java:292)
> at org.apache.phoenix.queryserver.client.SqllineWrapper.main(
> SqllineWrapper.java:83)
> Caused by: org.apache.calcite.avatica.org.apache.http.conn.HttpHostConnectException:
> Connect to localhost:8765 [localhost/127.0.0.1] failed: Connection
> refused (Connection refused)
> at org.apache.calcite.avatica.org.apache.http.impl.conn.
> DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOpe
> rator.java:158)
> at org.apache.calcite.avatica.org.apache.http.impl.conn.
> PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionMan
> ager.java:353)
> at org.apache.calcite.avatica.org.apache.http.impl.
> execchain.MainClientExec.establishRoute(MainClientExec.java:380)
> at org.apache.calcite.avatica.org.apache.http.impl.
> execchain.MainClientExec.execute(MainClientExec.java:236)
> at org.apache.calcite.avatica.org.apache.http.impl.execchain.ProtocolExec.
> execute(ProtocolExec.java:184)
> at org.apache.calcite.avatica.org.apache.http.impl.
> execchain.RetryExec.execute(RetryExec.java:88)
> at org.apache.calcite.avatica.org.apache.http.impl.execchain.RedirectExec.
> execute(RedirectExec.java:110)
> at org.apache.calcite.avatica.org.apache.http.impl.client.
> InternalHttpClient.doExecute(InternalHttpClient.java:184)
> at org.apache.calcite.avatica.org.apache.http.impl.client.
> CloseableHttpClient.execute(CloseableHttpClient.java:82)
> at org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientImpl.send(
> AvaticaCommonsHttpClientImpl.java:131)
> ... 18 more
> Caused by: java.net.ConnectException: Connection refused (Connection
> refused)
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.AbstractPlainSocketImpl.doConnect(
> AbstractPlainSocketImpl.java:350)
> at java.net.AbstractPlainSocketImpl.connectToAddress(
> AbstractPlainSocketImpl.java:206)
> at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:
> 188)
> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
> at java.net.Socket.connect(Socket.java:589)
> at org.apache.calcite.avatica.org.apache.http.conn.socket.
> PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.
> java:74)
> at org.apache.calcite.avatica.org.apache.http.impl.conn.
> DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOpe
> rator.java:141)
> ... 27 more
> sqlline version 1.1.9
> 0: jdbc:phoenix:thin:url=http://localhost:876>
>
> On Fri, Dec 16, 2016 at 10:42 AM, Cui Lin <ic...@gmail.com> wrote:
>
>> Hi Will,
>>
>>  curl http://localhost:8765
>> curl: (7) Failed to connect to localhost port 8765: Connection refused
>>
>> How I open this connection?
>>
>>
>>
>> On Fri, Dec 16, 2016 at 10:38 AM, Will Xu <wx...@hortonworks.com> wrote:
>>
>>> A few things.
>>>
>>> 1. Are you on 0.5 version of the connector?
>>>
>>> $>pip freeze | grep phoenixdb
>>>
>>> Should be==> phoenixdb==0.5
>>>
>>>
>>> 2. Can you try curl http://localhost:8765 to see if the server is
>>> actually running? If you open the page in browser you should see a Jetty
>>> 404 page.
>>>
>>>
>>> PQS is a think wrapper around Phoenix client. It's actually a service.
>>> If you have sqlline-thin client you can test it out.
>>>
>>> $>bin/sqlline-thin.py http://localhost:8765
>>>
>>> Regards,
>>> Will
>>> ------------------------------
>>> *From:* Cui Lin <ic...@gmail.com>
>>> *Sent:* Friday, December 16, 2016 10:29 AM
>>> *To:* user@phoenix.apache.org
>>> *Subject:* Phoenix database adapter for Python not working
>>>
>>> I followed the instruction from http://python-phoenixdb.readth
>>> edocs.io/en/latest/
>>>
>>> to connect Hbase in cloudera cluster, but I got the following error
>>> below.
>>>
>>>
>>> >>> import phoenixdb
>>> >>> database_url = 'http://localhost:8765/'
>>> >>> conn = phoenixdb.connect(database_url, autocommit=True)
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py",
>>> line 63, in connect
>>> client.connect()
>>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py",
>>> line 152, in connect
>>> raise errors.InterfaceError('Unable to connect to the specified
>>> service', e)
>>> phoenixdb.errors.InterfaceError: ('Unable to connect to the specified
>>> service', error(111, 'Connection refused'), None, None)
>>>
>>>
>>> I can create table using phoenix-sqlline.py localhost:2181:/hbase or
>>> even use ./psql.py to import CSV, why the python adaopter does not work?
>>> Could someone give me a simple example that allows the adapter to connect
>>> Hbase in Cloudera?
>>>
>>> I've been trying to find the solution for days... please help!
>>>
>>>
>>> --
>>> Best regards!
>>>
>>> Lin,Cui
>>>
>>
>>
>>
>> --
>> Best regards!
>>
>> Lin,Cui
>>
>
>
>
> --
> Best regards!
>
> Lin,Cui
>



-- 
Best regards!

Lin,Cui

Re: Phoenix database adapter for Python not working

Posted by Cui Lin <ic...@gmail.com>.
sqlline-thin.py does not work either. Did I have anything missing? I can
run
/sqlline.py localhost:2181:hbase without any problem.



# ./sqlline-thin.py http://localhost:8765
Failed to find hbase executable on PATH, defaulting serialization to
PROTOBUF.
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect
jdbc:phoenix:thin:url=http://localhost:8765;serialization=PROTOBUF
none none org.apache.phoenix.queryserver.client.Driver
Connecting to jdbc:phoenix:thin:url=http://localhost:8765;serialization
=PROTOBUF
java.lang.RuntimeException:
org.apache.calcite.avatica.org.apache.http.conn.HttpHostConnectException:
Connect to localhost:8765 [localhost/127.0.0.1] failed: Connection refused
(Connection refused)
at
org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientImpl.send(AvaticaCommonsHttpClientImpl.java:143)
at
org.apache.calcite.avatica.remote.RemoteProtobufService._apply(RemoteProtobufService.java:44)
at
org.apache.calcite.avatica.remote.ProtobufService.apply(ProtobufService.java:81)
at org.apache.calcite.avatica.remote.Driver.connect(Driver.java:175)
at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)
at sqlline.Commands.connect(Commands.java:1064)
at sqlline.Commands.connect(Commands.java:996)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)
at sqlline.SqlLine.dispatch(SqlLine.java:803)
at sqlline.SqlLine.initArgs(SqlLine.java:588)
at sqlline.SqlLine.begin(SqlLine.java:656)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:292)
at
org.apache.phoenix.queryserver.client.SqllineWrapper.main(SqllineWrapper.java:83)
Caused by:
org.apache.calcite.avatica.org.apache.http.conn.HttpHostConnectException:
Connect to localhost:8765 [localhost/127.0.0.1] failed: Connection refused
(Connection refused)
at
org.apache.calcite.avatica.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)
at
org.apache.calcite.avatica.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at
org.apache.calcite.avatica.org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at
org.apache.calcite.avatica.org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at
org.apache.calcite.avatica.org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at
org.apache.calcite.avatica.org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at
org.apache.calcite.avatica.org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at
org.apache.calcite.avatica.org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at
org.apache.calcite.avatica.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at
org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientImpl.send(AvaticaCommonsHttpClientImpl.java:131)
... 18 more
Caused by: java.net.ConnectException: Connection refused (Connection
refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at
org.apache.calcite.avatica.org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at
org.apache.calcite.avatica.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
... 27 more
sqlline version 1.1.9
0: jdbc:phoenix:thin:url=http://localhost:876>

On Fri, Dec 16, 2016 at 10:42 AM, Cui Lin <ic...@gmail.com> wrote:

> Hi Will,
>
>  curl http://localhost:8765
> curl: (7) Failed to connect to localhost port 8765: Connection refused
>
> How I open this connection?
>
>
>
> On Fri, Dec 16, 2016 at 10:38 AM, Will Xu <wx...@hortonworks.com> wrote:
>
>> A few things.
>>
>> 1. Are you on 0.5 version of the connector?
>>
>> $>pip freeze | grep phoenixdb
>>
>> Should be==> phoenixdb==0.5
>>
>>
>> 2. Can you try curl http://localhost:8765 to see if the server is
>> actually running? If you open the page in browser you should see a Jetty
>> 404 page.
>>
>>
>> PQS is a think wrapper around Phoenix client. It's actually a service. If
>> you have sqlline-thin client you can test it out.
>>
>> $>bin/sqlline-thin.py http://localhost:8765
>>
>> Regards,
>> Will
>> ------------------------------
>> *From:* Cui Lin <ic...@gmail.com>
>> *Sent:* Friday, December 16, 2016 10:29 AM
>> *To:* user@phoenix.apache.org
>> *Subject:* Phoenix database adapter for Python not working
>>
>> I followed the instruction from http://python-phoenixdb.readth
>> edocs.io/en/latest/
>>
>> to connect Hbase in cloudera cluster, but I got the following error below.
>>
>>
>> >>> import phoenixdb
>> >>> database_url = 'http://localhost:8765/'
>> >>> conn = phoenixdb.connect(database_url, autocommit=True)
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py",
>> line 63, in connect
>> client.connect()
>> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py",
>> line 152, in connect
>> raise errors.InterfaceError('Unable to connect to the specified service',
>> e)
>> phoenixdb.errors.InterfaceError: ('Unable to connect to the specified
>> service', error(111, 'Connection refused'), None, None)
>>
>>
>> I can create table using phoenix-sqlline.py localhost:2181:/hbase or even
>> use ./psql.py to import CSV, why the python adaopter does not work? Could
>> someone give me a simple example that allows the adapter to connect Hbase
>> in Cloudera?
>>
>> I've been trying to find the solution for days... please help!
>>
>>
>> --
>> Best regards!
>>
>> Lin,Cui
>>
>
>
>
> --
> Best regards!
>
> Lin,Cui
>



-- 
Best regards!

Lin,Cui

Re: Phoenix database adapter for Python not working

Posted by Josh Elser <jo...@gmail.com>.
Just to clarify, like near all other services on Linux, you do not want 
to run the Phoenix Query Server as root. Running it as the "hbase" user 
(or the user you are running hbase as) is the common way to do this.

Will Xu wrote:
> OK, this means you probably don't have Phoenix query server started.
>
> I'm not a cloudera distro expert, but I assume you can locate this file
> "queryserver.py"
>
>
> Run
>
> $>sudo ./queryserver.py start
>
>
> And try curl again
>
>
> For more details:
>
> https://phoenix.apache.org/server.html\u200b
>
>
> Don't hesitate to reach out if you run into more roadblocks.
>
>
> Regards,
>
> Will
>
> ------------------------------------------------------------------------
> *From:* Cui Lin <ic...@gmail.com>
> *Sent:* Friday, December 16, 2016 10:42 AM
> *To:* user@phoenix.apache.org
> *Subject:* Re: Phoenix database adapter for Python not working
> Hi Will,
>
> curl http://localhost:8765
> curl: (7) Failed to connect to localhost port 8765: Connection refused
>
> How I open this connection?
>
>
>
> On Fri, Dec 16, 2016 at 10:38 AM, Will Xu <wxu@hortonworks.com
> <ma...@hortonworks.com>> wrote:
>
>     A few things.
>
>     1. Are you on 0.5 version of the connector?
>
>     $>pip freeze | grep phoenixdb
>
>     Should be==> phoenixdb==0.5
>
>
>     2. Can you try curl http://localhost:8765 to see if the server is
>     actually running? If you open the page in browser you should see a
>     Jetty 404 page.
>
>
>     PQS is a think wrapper around Phoenix client. It's actually a
>     service. If you have sqlline-thin client you can test it out.
>
>     $>bin/sqlline-thin.py http://localhost:8765
>
>
>     Regards,
>     Will
>     ------------------------------------------------------------------------
>     *From:* Cui Lin <icecreamlc426@gmail.com
>     <ma...@gmail.com>>
>     *Sent:* Friday, December 16, 2016 10:29 AM
>     *To:* user@phoenix.apache.org <ma...@phoenix.apache.org>
>     *Subject:* Phoenix database adapter for Python not working
>     I followed the instruction from
>     http://python-phoenixdb.readthedocs.io/en/latest/
>     <http://python-phoenixdb.readthedocs.io/en/latest/>
>
>     to connect Hbase in cloudera cluster, but I got the following error
>     below.
>
>
>      >>> import phoenixdb
>      >>> database_url = 'http://localhost:8765/'
>      >>> conn = phoenixdb.connect(database_url, autocommit=True)
>     Traceback (most recent call last):
>     File "<stdin>", line 1, in <module>
>     File
>     "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py",
>     line 63, in connect
>     client.connect()
>     File
>     "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py",
>     line 152, in connect
>     raise errors.InterfaceError('Unable to connect to the specified
>     service', e)
>     phoenixdb.errors.InterfaceError: ('Unable to connect to the
>     specified service', error(111, 'Connection refused'), None, None)
>
>
>     I can create table using phoenix-sqlline.py localhost:2181:/hbase or
>     even use ./psql.py to import CSV, why the python adaopter does not
>     work? Could someone give me a simple example that allows the adapter
>     to connect Hbase in Cloudera?
>
>     I've been trying to find the solution for days... please help!
>
>
>     --
>     Best regards!
>
>     Lin,Cui
>
>
>
>
> --
> Best regards!
>
> Lin,Cui

Re: Phoenix database adapter for Python not working

Posted by Will Xu <wx...@hortonworks.com>.
OK, this means you probably don't have Phoenix query server started.

I'm not a cloudera distro expert, but I assume you can locate this file "queryserver.py"


Run

$>sudo ./queryserver.py start


And try curl again


For more details:

https://phoenix.apache.org/server.html?


Don't hesitate to reach out if you run into more roadblocks.


Regards,

Will

________________________________
From: Cui Lin <ic...@gmail.com>
Sent: Friday, December 16, 2016 10:42 AM
To: user@phoenix.apache.org
Subject: Re: Phoenix database adapter for Python not working

Hi Will,

 curl http://localhost:8765
curl: (7) Failed to connect to localhost port 8765: Connection refused

How I open this connection?



On Fri, Dec 16, 2016 at 10:38 AM, Will Xu <wx...@hortonworks.com>> wrote:

A few things.

1. Are you on 0.5 version of the connector?

$>pip freeze | grep phoenixdb

Should be==> phoenixdb==0.5


2. Can you try curl http://localhost:8765 to see if the server is actually running? If you open the page in browser you should see a Jetty 404 page.


PQS is a think wrapper around Phoenix client. It's actually a service. If you have sqlline-thin client you can test it out.

$>bin/sqlline-thin.py http://localhost:8765

Regards,
Will
________________________________
From: Cui Lin <ic...@gmail.com>>
Sent: Friday, December 16, 2016 10:29 AM
To: user@phoenix.apache.org<ma...@phoenix.apache.org>
Subject: Phoenix database adapter for Python not working

I followed the instruction from http://python-phoenixdb.readthedocs.io/en/latest/

to connect Hbase in cloudera cluster, but I got the following error below.


>>> import phoenixdb
>>> database_url = 'http://localhost:8765/'
>>> conn = phoenixdb.connect(database_url, autocommit=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py", line 63, in connect
client.connect()
File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py", line 152, in connect
raise errors.InterfaceError('Unable to connect to the specified service', e)
phoenixdb.errors.InterfaceError: ('Unable to connect to the specified service', error(111, 'Connection refused'), None, None)


I can create table using phoenix-sqlline.py localhost:2181:/hbase or even use ./psql.py to import CSV, why the python adaopter does not work? Could someone give me a simple example that allows the adapter to connect Hbase in Cloudera?

I've been trying to find the solution for days... please help!


--
Best regards!

Lin,Cui



--
Best regards!

Lin,Cui

Re: Phoenix database adapter for Python not working

Posted by Cui Lin <ic...@gmail.com>.
Hi Will,

 curl http://localhost:8765
curl: (7) Failed to connect to localhost port 8765: Connection refused

How I open this connection?



On Fri, Dec 16, 2016 at 10:38 AM, Will Xu <wx...@hortonworks.com> wrote:

> A few things.
>
> 1. Are you on 0.5 version of the connector?
>
> $>pip freeze | grep phoenixdb
>
> Should be==> phoenixdb==0.5
>
>
> 2. Can you try curl http://localhost:8765 to see if the server is
> actually running? If you open the page in browser you should see a Jetty
> 404 page.
>
>
> PQS is a think wrapper around Phoenix client. It's actually a service. If
> you have sqlline-thin client you can test it out.
>
> $>bin/sqlline-thin.py http://localhost:8765
>
> Regards,
> Will
> ------------------------------
> *From:* Cui Lin <ic...@gmail.com>
> *Sent:* Friday, December 16, 2016 10:29 AM
> *To:* user@phoenix.apache.org
> *Subject:* Phoenix database adapter for Python not working
>
> I followed the instruction from http://python-phoenixdb.
> readthedocs.io/en/latest/
>
> to connect Hbase in cloudera cluster, but I got the following error below.
>
>
> >>> import phoenixdb
> >>> database_url = 'http://localhost:8765/'
> >>> conn = phoenixdb.connect(database_url, autocommit=True)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py",
> line 63, in connect
> client.connect()
> File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py",
> line 152, in connect
> raise errors.InterfaceError('Unable to connect to the specified service',
> e)
> phoenixdb.errors.InterfaceError: ('Unable to connect to the specified
> service', error(111, 'Connection refused'), None, None)
>
>
> I can create table using phoenix-sqlline.py localhost:2181:/hbase or even
> use ./psql.py to import CSV, why the python adaopter does not work? Could
> someone give me a simple example that allows the adapter to connect Hbase
> in Cloudera?
>
> I've been trying to find the solution for days... please help!
>
>
> --
> Best regards!
>
> Lin,Cui
>



-- 
Best regards!

Lin,Cui

Re: Phoenix database adapter for Python not working

Posted by Will Xu <wx...@hortonworks.com>.
A few things.

1. Are you on 0.5 version of the connector?

$>pip freeze | grep phoenixdb

Should be==> phoenixdb==0.5


2. Can you try curl http://localhost:8765 to see if the server is actually running? If you open the page in browser you should see a Jetty 404 page.


PQS is a think wrapper around Phoenix client. It's actually a service. If you have sqlline-thin client you can test it out.

$>bin/sqlline-thin.py http://localhost:8765

Regards,
Will
________________________________
From: Cui Lin <ic...@gmail.com>
Sent: Friday, December 16, 2016 10:29 AM
To: user@phoenix.apache.org
Subject: Phoenix database adapter for Python not working

I followed the instruction from http://python-phoenixdb.readthedocs.io/en/latest/

to connect Hbase in cloudera cluster, but I got the following error below.


>>> import phoenixdb
>>> database_url = 'http://localhost:8765/'
>>> conn = phoenixdb.connect(database_url, autocommit=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/__init__.py", line 63, in connect
client.connect()
File "/root/anaconda2/lib/python2.7/site-packages/phoenixdb/avatica.py", line 152, in connect
raise errors.InterfaceError('Unable to connect to the specified service', e)
phoenixdb.errors.InterfaceError: ('Unable to connect to the specified service', error(111, 'Connection refused'), None, None)


I can create table using phoenix-sqlline.py localhost:2181:/hbase or even use ./psql.py to import CSV, why the python adaopter does not work? Could someone give me a simple example that allows the adapter to connect Hbase in Cloudera?

I've been trying to find the solution for days... please help!


--
Best regards!

Lin,Cui