DataGrip 连接 HiveServer2 报错的原因是什么?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
一、Heap memory
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
因为 DataGrip 会开好几个 Session,我这里是 4 个 Session
因此有时候如果执行的语句过大,会造成堆内存来不起回收。导致堆内存溢出,反应在 DataGrip 就是执行语句卡住没反应,等很久然后报错。这里有个超时时间,等很久就是超过这个超时时间后报错。
我们可以适当调大 heap 内存:
# 在 hive/bin 目录下的 hive-config.sh,最后一行就是设置 heap 的大小。
69 # Default to use 256MB
70 export HADOOP_HEAPSIZE=${HADOOP_HEAPSIZE:-2048}
二、Too many open files
lzq@hadoop102 ~ ulimit -a
-t: cpu time (seconds) unlimited
-f: file size (blocks) unlimited
-d: data seg size (kbytes) unlimited
-s: stack size (kbytes) 8192
-c: core file size (blocks) 0
-m: resident set size (kbytes) unlimited
-u: processes 10000
-n: file descriptors 4096
-l: locked-in-memory size (kbytes) 64
-v: address space (kbytes) unlimited
-x: file locks unlimited
-i: pending signals 31830
-q: bytes in POSIX msg queues 819200
-e: max nice 0
-r: max rt priority 0
-N 15: unlimited
修改最大文件连接数量
-n: file descriptors 4096
描述的就是一进程可以打开文件最大的数量ulimit -n 4096
把最大打开文件调整到 4096,如果重启会还原成默认值vim /etc/security/limits.conf
在最后加入
* soft nofile 65535
* hard nofile 65535
安装 lsof
sudo yum install lsof -y
查看当前系统打开的文件数量
lsof | wc -l
watch "lsof | wc -l"
lzq@hadoop102 ~ jps
25696 Jps
1522 NameNode
22627 RunJar
1716 DataNode
3140 Kafka
2309 NodeManager
2647 QuorumPeerMain
22889 RunJar
23322 RunJar
查看某一进程的打开文件数量
# RunJar 就是 HiveServer2 的进程
lsof -p pid | wc -l
lsof -p 22627 | wc -l
lsof -p 22889 | wc -l
lsof -p 23322 | wc -l
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。
亿速云「云数据库 MySQL」免部署即开即用,比自行安装部署数据库高出1倍以上的性能,双节点冗余防止单节点故障,数据自动定期备份随时恢复。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。