如何解决重启Hadoop集群时nonamenodetostop的异常
这篇文章主要介绍了如何解决重启Hadoop集群时no namenode to stop的异常,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
创新互联建站主要从事网站设计、成都网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务台前,十多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220
修改了hadoop集群的配置文件而需要重启集群,但是却报错如下:
[hadoop@master ~]# stop-dfs.sh Stopping namenodes on [master] master1: no namenode to stop master2: no namenode to stop slave2: no datanode to stop slave1: no datanode to stop
问题的原因是hadoop在stop的时候依据的是datanode上的journalnode和dfs的pid。而默认的进程号保存在/tmp下,linux 默认会每隔一段时间(一般是一个月或者7天左右)去删除这个目录下的文件。
因此删掉hadoop-hadoop-journalnode.pid和hadoop-hadoop-datanode.pid两个文件后,namenode自然就找不到datanode上的这两个进程了。
在配置文件hadoop_env.sh中配置export HADOOP_PID_DIR可以解决这个问题, 也可以在hadoop-deamon.sh中修改,它会调用hadoop_env.sh。修改HADOOP_PID_DIR的路径为“/var/hadoop_pid”,记得手动在“/var”目录下创建hadoop_pid文件夹并将owner权限分配给hadoop用户。
[hadoop@slave3 ~]$ ls /var/hadoop_pid/ hadoop-hadoop-datanode.pid hadoop-hadoop-journalnode.pid
然后手动在出错的Slave上杀死Datanode的进程(kill -9 pid),再重新运行start-dfs..sh时发现没有“no datanode to stop”和“no namenode to stop”的出现,问题解决。
[hadoop@master1 ~]$ start-dfs.sh 16/04/13 17:20:26 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Starting namenodes on [master1 master2] master1: starting namenode, logging to /data/usr/hadoop/logs/hadoop-hadoop-namenode-master1.out master2: starting namenode, logging to /data/usr/hadoop/logs/hadoop-hadoop-namenode-master2.out slave4: starting datanode, logging to /data/usr/hadoop/logs/hadoop-hadoop-datanode-slave4.out slave3: starting datanode, logging to /data/usr/hadoop/logs/hadoop-hadoop-datanode-slave3.out slave2: starting datanode, logging to /data/usr/hadoop/logs/hadoop-hadoop-datanode-slave2.out slave1: starting datanode, logging to /data/usr/hadoop/logs/hadoop-hadoop-datanode-slave1.out Starting journal nodes [master1 master2 slave1 slave2 slave3] slave3: starting journalnode, logging to /data/usr/hadoop/logs/hadoop-hadoop-journalnode-slave3.out master1: starting journalnode, logging to /data/usr/hadoop/logs/hadoop-hadoop-journalnode-master1.out slave1: starting journalnode, logging to /data/usr/hadoop/logs/hadoop-hadoop-journalnode-slave1.out master2: starting journalnode, logging to /data/usr/hadoop/logs/hadoop-hadoop-journalnode-master2.out slave2: starting journalnode, logging to /data/usr/hadoop/logs/hadoop-hadoop-journalnode-slave2.out 16/04/13 17:20:40 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Starting ZK Failover Controllers on NN hosts [master1 master2] master1: starting zkfc, logging to /data/usr/hadoop/logs/hadoop-hadoop-zkfc-master1.out master2: starting zkfc, logging to /data/usr/hadoop/logs/hadoop-hadoop-zkfc-master2.out
感谢你能够认真阅读完这篇文章,希望小编分享的“如何解决重启Hadoop集群时no namenode to stop的异常”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联行业资讯频道,更多相关知识等着你来学习!
当前名称:如何解决重启Hadoop集群时nonamenodetostop的异常
分享路径:http://scyanting.com/article/jpsihi.html