python连接到配置单元时出现pyhive get错误

bwntbbo3  于 2021-05-29  发布在  Hadoop
关注(0)|答案(0)|浏览(330)

当我使用pyhive连接配置单元服务get error时,这是我的操作步骤
我用下面的命令启动配置单元服务

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)

我能做些什么来解决这个问题?谢谢。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题