Datanode cannot start when Hadoop user creates data directory

Source: Internet
Author: User
Tags mkdir xsl

Scenario: Centos 6.4 X64

Hadoop 0.20.205

Configuration file

Hdfs-site.xml

<?xml version= "1.0"?>
<?xml-stylesheet type= "text/xsl" href= "configuration.xsl"?>


<!--Put Site-specific property overrides in the this file. -
<configuration>
<property>
<name>dfs.name.dir</name>
<value>/usr/local/hadoop/hdfs/name</value>
</property>

<property>
<name>dfs.data.dir</name>
<value>/usr/local/hadoop/hdfs/data</value>
</property>


<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>


When creating the data directory used by the Dfs.data.dir, it is created directly with the Hadoop user,

Mkidr-p/usr/local/hdoop/hdfs/data

The Namenode node can then be started when it is formatted and started.

When executing JPS on the Datanode,

[Hadoop@datanode1 local]# JPS
6763 Tasktracker
6816 Jps

No datanode process, no matter how it is formatted, cannot make the Datanode process appear

Back, go to view the logs on the DATANODE1 node

2013-04-10 20:50:49,100 WARN org.apache.hadoop.hdfs.server.datanode.DataNode:Invalid directory in Dfs.data.dir: Incorrect permission For/usr/local/hadoop/hdfs/data, expected:rwxr-xr-x, while Actual:rwxrwxr-x
2013-04-10 20:50:49,100 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode:All directories in Dfs.data.dir is Invalid.

Prompt permission does not meet the requirements

chmod 755/usr/local/hadoop/hdfs/data

Restart

[Hadoop@datanode1 data]$ JPS
7398 Tasktracker
7291 DataNode
7707 Jps


Datanode appears

To verify the difference between the root user and the Hadoop user's Create folder

[Root@namenode home]# mkdir data
[Root@namenode home]# LL
Total Dosage 24
Drwxr-xr-x. 2 root root 4096 April 21:03 data
DRWX------. 5 Hadoop hadoop 4096 April 20:45 Hadoop
DRWX------. 2 root root 16384 April 8 09:28 Lost+found

You can see that the root user created the folder permissions to meet the requirements

Then create a folder with Hadoop users

[Hadoop@namenode ~]$ mkdir Name
[Hadoop@namenode ~]$ LL
Total Dosage 4
Drwxrwxr-x. 2 Hadoop hadoop 4096 April 21:04 name
[Hadoop@namenode ~]$

Permissions have changed, causing Datanode to fail to start.

Conclusion: In order not to modify the owner of the folder, directly with the Hadoop user to create a folder, the result of a permissions problem, resulting in datanode cannot start.

Harvest: 1, understand the different user group permissions,

2, encounter problems, must be inquisitive, can not be specious, otherwise, wasted time, oneself but smattering, this state is the worst state.

3, multi-view logs, from the log to find the problem.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.