beeline> !connect jdbc:hive2://127.0.0.1:10000/default;auth=noSasl hive pass
Connecting to jdbc:hive2://127.0.0.1:10000/default;auth=noSasl
21/03/05 10:01:30 [main]: WARN jdbc.HiveConnection: Failed to connect to 127.0.0.1:10000
Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://127.0.0.1:10000/default;auth=noSasl: java.net.ConnectException: Connection refused (Connection refused) (state=08S01,code=0)
主要原因是hadoop引入了一个安全伪装机制,使得hadoop 不允许上层系统直接将实际用户传递到hadoop层,而是将实际用户传递给一个超级代理,由此代理在hadoop上执行操作,避免任意客户端随意操作hadoop,
改hive设置,把hive-site配置里的hive.server2.enable.doAs设置成false,让查询以运行hiveserver2进程的用户执行,这样就有权限了
conf/hive-site.xml
<name>hive.server2.enable.doAs</name>
<value>false</value>
改后。
beeline> !connect jdbc:hive2://127.0.0.1:10000/default;auth=noSasl hive pass
Connecting to jdbc:hive2://127.0.0.1:10000/default;auth=noSasl
Connected to: Apache Hive (version 2.1.1)
Driver: Hive JDBC (version 2.1.1)
21/03/05 10:02:05 [main]: WARN jdbc.HiveConnection: Request to set autoCommit to false; Hive does not support autoCommit=false.
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://127.0.0.1:10000/default> show databases;
+----------------+--+
| database_name |
+----------------+--+
| default |
+----------------+--+
1 row selected (0.828 seconds)
参考:
https://blog.csdn.net/yunyexiangfeng/article/details/60867563
网友评论