Reputation: 1
I am using Apache Kylin on a docker container, the services working normally, but I am having some troubles connecting to Hive using pyhive. I would like to list my databases using "show databases;" in code bellow, but I'm getting this error:
Traceback (most recent call last):
File "hive.py", line 3, in <module>
conn = hive.Connection(host="localhost", port=10001, username="root")
File "/usr/lib/python2.7/site-packages/pyhive/hive.py", line 243, in __init__
self._transport.open()
File "/usr/lib/python2.7/site-packages/thrift_sasl/__init__.py", line 74, in open
self._trans.open()
File "/usr/lib64/python2.7/site-packages/thrift/transport/TSocket.py", line 146, in open
raise TTransportException(type=TTransportException.NOT_OPEN, message=msg)
thrift.transport.TTransport.TTransportException: Could not connect to any of [('127.0.0.1', 10001), ('::1', 10001, 0, 0)]
and this is my basic code:
from pyhive import hive
conn = hive.Connection(host="localhost", port=10001, username="root")
cursor = conn.cursor()
print(cursor.execute("SHOW DATABASES"))
conn.close()
I already tried to connect using port 10000 and 10001, but without success. I'm using Python 2.7.5 with these modules on pip:
PyHive
thrift-sasl
thrift
sasl
Upvotes: 0
Views: 363
Reputation: 31
docker run -d \
-m 8G \
-p 7070:7070 \
-p 8088:8088 \
-p 50070:50070 \
-p 8032:8032 \
-p 8042:8042 \
-p 2181:2181 \
apachekylin/apache-kylin-standalone:4.0.0
so you need to add an external port mapping as followed.
docker run -d \
-m 8G \
...
-p 10000:10000 \
apachekylin/apache-kylin-standalone:4.0.0
Why the port is 10000? If you check the source code for Kylin docker, you will find that the docker uses default configs for the hive.
Please try again.
Upvotes: 0