问题1:No output streams registered, so nothing to execute
解决原因:没有触发DStream需要的aciton
解决方法:使用以下方法之一触发:
print()
foreachRDD()
saveAsObjectFiles()
saveAsTextFiles()
saveAsHadoopFiles()
问题2:程序运行一段时间后org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
这个问题的应用背景是使用streaming接受kafka数据,然后数据处理后存到hbase数据库。程序运行大概两天后就抛出这个异常。这是zookeeper的问题,通过查看zookeeper日志发现,是因为超过最大连接数,通过设置zookeeper的zoo.cfg文件即可解决问题:
# increase this if you need to handle more clients
#默认是60
maxClientCnxns=600
问题3:java.io.FileNotFoundException:(Too many open files)
linxu系统下每个用户同时打开文件的个数是有限制的:
查看
ulimit -n
1024
系统为每个用户默认最大数为1024个,下面我们对这个数进行修改:
1.修改/etc/security/limits.conf
2.添加如下一行:
* - nofile 10240
推出shell重新登陆,再次查看ulimit -n,如果进程已经再跑了,需要重启进程
问题4:executor被杀掉(YARN环境下):ERROR executor.CoarseGrainedExecutorBackend: RECEIVED SIGNAL 15: SIGTERM
之所以会被杀掉是因为container off heap内存超过了内存限制,所谓off head 就是非堆空间内存,一般为vm本身消耗,默认是executor内存的10%,适当调大以下两个参数:
spark.yarn.driver.memoryOverhead
spark.yarn.executor.memoryOverhead
参数解释:http://spark.apache.org/docs/latest/running-on-yarn.html