Hive连接报错Unexpected end of file when reading from HS2 server.

启动hiveserver2之后,使用如下命令连接hive:
          bin/beeline -u jdbc:hive2://hadoop03:10000 -n hadoop
报错:
Unexpected end of file when reading from HS2 server. The root cause might be too many concurrent connections. Please ask the administrator to check the number of active connections, and adjust hive.server2.thrift.max.worker.threads if applicable.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://hadoop03:10000: null (state=08S01,code=0)

使用hive jdbc连接也报错:
java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://192.168.96.183:10000/default;: null
Caused by: org.apache.thrift.transport.TTransportException

原因是:
在hive-site.xml中配置了:
<property>
          <name>hive.server2.authentication</name>
            <value>NOSASL</value>
</property>

解决办法:
beeline连接时,先 /bin/beeline进入beeline界面,然后输入命令
 !connect jdbc:hive2://hadoop03:10000/default;auth=noSasl 登录hive的用户名 pass org.apache.hive.jdbc.HiveDriver
jdbc连接时加上字符串 auth=noSasl指定连接属性即可:
jdbc:hive2://192.168.96.183:10000/default;auth=noSasl

猜你喜欢

转载自blog.csdn.net/qq_26010491/article/details/80001678
今日推荐