How to connect to hive using python pyhs2?

青春壹個敷衍的年華 提交于 2019-12-02 00:59:08

1- Figure out the IP address of the localhost using (on Linux):

hostname -I

2- Change localhost to the actual ip

I would also suggest that you double check which host Hive is on. If you are using hortonworks, on Ambari, go to Hive, then Configs and check the host there.

Edit (adding another suggestion):

Your username and password most likely aren't None. To get your username and password, check hive-site.xml and look at the values in javax.jdo.option.ConnectionUserName and javax.jdo.option.ConnectionPassword. If you can't find anything, try an empty string as the password (as opposed to None), and hive or empty string as the username i.e. try these one by one:

conn = pyhs2.connect(host='localhost', port=10000,authMechanism='PLAIN', user='hive', password='',database='default')

conn = pyhs2.connect(host='localhost', port=10000,authMechanism='PLAIN', user='', password='',database='default')

Note that I also changed authMechanism to "PLAIN"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!