原因:在root账户(非hadoop账户)下操作hadoop会导致很大的问题
首先运行bin/start-all.sh发现namenode没有启动
只有它们
9428 DataNode
9712 JobTracker
9626 SecondaryNameNode
9983 Jps
9915 TaskTracker
遇到问题要学会翻看日志
cd /usr/local/hadoop/logs
发现日志下面有这个文件
hadoop-hadoop-namenode-ubuntu.log.2014-07-29
用vim打开,只要看err出错部分如下
2014-07-29 02:30:22,388 ERRORorg.apache.hadoop.hdfs.server.namenode.FSNamesystem: FSNamesysteminitialization failed.
java.io.FileNotFoundException: /usr/local/hadoop/hdfs/name/in_use.lock(Permission denied)
atjava.io.RandomAccessFile.open(Native Method)
atjava.io.RandomAccessFile.<init>(RandomAccessFile.java:236)
atorg.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.tryLock(Storage.java:617)
atorg.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.lock(Storage.java:594)
atorg.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.analyzeStorage(Storage.java:452)
atorg.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:299)
atorg.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:104)
atorg.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:427)
atorg.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:395)
是我上次用root操作hadoop所致的
更改权限即可,改成hadoop所有
chown -R hadoop:hadoop /usr/local/hadoop/hdfs/*
chown -R hadoop:hadoop /usr/local/hadoop/logs(日志文件也要改)
先bin/stop-all.sh
再bin/start-all.sh
Namenode就又正常启动了