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
Check
Solution
so you need to add an external port mapping as followed.
Please try again.