Hadoop1.2.0的DataNode启动失败异常

在配置hadoop1.x的集群时,如果我们在hdfs-site.xml里面,如果明确指定了dfs的路径,需要设置下dfs.data.dir的权限,下面是散仙在Hadoop1.2.0里面的配置:
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>

<property>
<name>dfs.name.dir</name>
<value>/home/search/hadoop/hadoopnd</value>
</property>
<!--  注意这个文件夹目录需要单独设置755权限,否则会报异常,在Hadoop2.2.0中不存在这个问题 -->
<property>
<name>dfs.data.dir</name>
<value>/home/search/hadoop/hadoopdd</value>
</property>
<property>
<name>dfs.tmp.dir</name>
<value>/home/search/hadoop/tmp</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>

</configuration>


异常详情:
[search@ph1 logs]$ tail -100f hadoop-search-datanode-ph1.log 
2014-07-16 22:08:58,139 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting DataNode
STARTUP_MSG:   host = ph1/192.168.46.23
STARTUP_MSG:   args = []
STARTUP_MSG:   version = 1.2.0
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1479473; compiled by 'hortonfo' on Mon May  6 06:59:37 UTC 2013
STARTUP_MSG:   java = 1.7.0_25
************************************************************/
2014-07-16 22:08:58,463 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2014-07-16 22:08:58,485 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2014-07-16 22:08:58,487 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2014-07-16 22:08:58,487 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2014-07-16 22:08:58,664 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2014-07-16 22:08:58,779 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Invalid directory in dfs.data.dir: Incorrect permission for /home/search/hadoop/hadoopdd, expected: rwxr-xr-x, while actual: rwxrwxr-x
2014-07-16 22:08:58,779 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: All directories in dfs.data.dir are invalid.
2014-07-16 22:08:58,779 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Exiting Datanode
2014-07-16 22:08:58,784 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down DataNode at ph1/192.168.46.23
************************************************************/

注意日志里面warn和error处的信息,
出现这个异常,会导致DataNode启动失败,解决办法:
使用root用户,给这个文件夹赋值755权限,执行命令如下:

 chmod 755 -R  /home/search/hadoop-1.2.0/hadoopdd 



你可能感兴趣的:(java,hadoop)