1.查找hive的查询报错在hive的日志中。找hive的日志一般在hive的安装目录的conf中有个log的配置文件可以找到日志的位置。一般默认为/tmp/用户名/hive.log
2.常见的错误
java.io.IOException: Connection reset by peer
问题描述:hive 查询卡死,无法执行hive的命令
错误信息:
2013-03-2212:54:43,946 WARN zookeeper.ClientCnxn(ClientCnxn.java:run(1089)) - Session 0x0 for serverhostname/***.***.***.***:2181, unexpected error, closing socket connection andattempting reconnect
java.io.IOException: Connection reset by peer
atsun.nio.ch.FileDispatcher.read0(Native Method)
atsun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
atsun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
atsun.nio.ch.IOUtil.read(IOUtil.java:200)
atsun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)
atorg.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:68)
atorg.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:355)
atorg.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
进一步确认可以查看zk的日志还有netstat -nap | grep 2181|wc -l
解决办法:
修改hive-site.xml中的配置
<property>
<name>hive.server2.thrift.min.worker.threads</name>
<value>5</value>
<description>Minimum number ofThrift workerthreads</description>
</property>
<property>
<name>hive.server2.thrift.max.worker.threads</name>
<value>100</value>
<description>Maximum number ofThrift worker threads</description>
</property>
修改zoo.cfg中的配置
#Limits the number of concurrent connections (at the socket level) that a singleclient, identified by IP address
maxClientCnxns=200
# The minimum session timeout in milliseconds that the server will allow theclient to negotiate
minSessionTimeout=1000
# The maximum session timeout in milliseconds that the server will allow theclient to negotiate
maxSessionTimeout=60000