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 <[email protected]> Sent: Friday, December 16, 2016 10:47 AM To: [email protected] 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 <[email protected]<mailto:[email protected]>> 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 <[email protected]<mailto:[email protected]>> 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 <[email protected]<mailto:[email protected]>> 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 <[email protected]<mailto:[email protected]>> Sent: Friday, December 16, 2016 10:29 AM To: [email protected]<mailto:[email protected]> 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
