现象
从Trafci中执行查询Hive表,有时候能成功,有时候失败,失败时的报错信息如下,
SQL>select * from hive.dma.dim_applbasque limit 1;
*** ERROR[1192] Failed to retrieve data from Hive metastore. Call to HiveClient_JNI::getTableStr() returned error Java exception in getHiveTableStr().(131). Cause: java.lang.NullPointerException. [2018-06-21 15:26:45]
分析
以上错误表示在读取Hive metadata时抛出空指针异常,根本原因是JVM创建失败,推测与内存有关。由于集群环境是虚拟机配置,内存仅16G,并且未配置swap,怀疑与未配置swap有关。
[root@bigdatatst014 ~]# free
total used free shared buff/cache available
Mem: 16268612 9583376 4590600 671896 2094636 5744804
Swap: 0 0 0
解决
配置每个trafodion节点的swap空间为总内存的一半-2,即6G,配置完后的free结果如下,
[trafodion@bigdatatst014 ~]$ free -h
total used free shared buff/cache available
Mem: 15G 8.8G 658M 656M 6.0G 5.8G
Swap: 5.9G 0B 5.9G
配置完成后重启DCS服务,错误不再重现,关于如何配置Linux机器的swap,可参考我的另外一篇博客:https://blog.csdn.net/post_yuan/article/details/80831348