介绍Hadoop解决 datanode无法启动/Live Nodes为0的问题的一种方法。在hadoop的logs目录中查看datanode的日志信息,发现错误:
WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Source name ugi already exists!
WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Invalid directory in dfs.data.dir: Incorrect permission for /home/hzw/user/local/hadoop/hadoop-1.2.1/hdfs/data, expected: rwxr-xr-x, while actual: rwxrwxr-x
ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: All directories in dfs.data.dir are invalid.
进入hadoop目录,例如:cd ~/user/local/hadoop/hadoop-1.2.1
运行命令chown -R [owner]:[group] ./ ,owner用@ubuntu前面的用户名替换即可,例如:
运行命令:chmod -R 755 ./
运行命令:./bin/hadoop namenode -format
运行命令:./bin/start-all.sh
运行命令:jps
访问:localhost:50070