python用pyhive连接到蜂巢获取错误

时间:2019-08-15 11:01:09

标签: python hadoop hive

当我使用pyhive连接hive服务时出现错误,这是我的操作步骤

我通过以下命令启动蜂巢服务

hive --service hiveserver2 --hiveconf hive.server2.thrift.port=10001
hive --service metastore

然后使用Pyhive创建连接

from pyhive import hive
conn = hive.Connection(host='localhost', port=10001, database='default')

但是我在下面出现错误

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/python3/lib/python3.7/site-packages/pyhive/hive.py", line 199, in __init__
    _check_status(response)
  File "/usr/local/python3/lib/python3.7/site-packages/pyhive/hive.py", line 495, in _check_status
    raise OperationalError(response)
pyhive.exc.OperationalError: 
TOpenSessionResp(status=TStatus(statusCode=3, infoMessages=['*org.apache.hive.service.cli.HiveSQLException:Failed to open new session:
 java.lang.RuntimeException: 
org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): 
User: admin is not allowed to impersonate admin:14:13', 
'org.apache.hive.service.cli.session.SessionManager:createSession:SessionManager.java:419', 
'org.apache.hive.service.cli.session.SessionManager:openSession:SessionManager.java:362', 
'org.apache.hive.service.cli.CLIService:openSessionWithImpersonation:CLIService.java:193', 
xxxxxxorg.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): 
User: admin is not allowed to impersonate admin'), serverProtocolVersion=9, sessionHandle=None, configuration=None)

我该怎么做才能解决此问题?谢谢。

0 个答案:

没有答案