Hadoop cluster starts slave node without DataNode

Table of contents

1. Problem background

2. Solution ideas

3. Solution:


1. Problem background

There was no problem when starting the hadoop cluster before. When I started the hadoop cluster today, the DataNode of the slave node did not start.

2. Solution ideas

If the node cannot get up, you can check the log file of the current node.

I went into the Logs file of the hadoop installation directory of the current slave node to check the log, and found that the log reported an error (if you check the log and find a lot of at, it means there is a problem, don't worry about the long list of at) , we only need to find the first sentence before at, that sentence is the key to the problem)

When I checked the log file, I got the following error:

 WARN org.apache.hadoop.hdfs.server.common.Storage: Failed to add storage directory [DISK]file:/home/hadoop/software/hadooptmp/dfs/data
org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /home/hadoop/software/hadooptmp/dfs/data is in an inconsistent state: Can't format the storage directory because the current directory is not empty.

 The general problem is that I cannot add files to the directory where I store data, and it says that the current directory is not empty.

3. Solution:

1. On the master node of the cluster , use root identity and enter the tmp directory

After logging in as root user

cd /tmp

Then ll view the contents of the tmp directory

 You will see some files starting with hadoop (I have three files here, yours may be different from mine, but it doesn’t matter), delete all the files starting with hadoop

The purpose of deletion is because the hadoop cluster needs to be reformatted next. These files were generated when the files were formatted before. If you do not delete these files and directly reformat the hadoop cluster, some problems and conflicts may occur later. situation, so these files must be deleted first.

2. Delete hadoop log files

(1) Delete all contents under the file where Hadoop stores data. Each host must be deleted separately.

If you don’t know where the directory where your hadoop stores data is, you can check it in the /etc/hadoop/core-site.xml file in the hadoop installation directory.

(2) On each host of the cluster, enter the logs file in the hadoop installation directory and delete all files under the logs.

 Note: Each host in the hadoop cluster must be deleted here

3. Format hadoop

hadoop  namenode -format

4. Start the Hadoop cluster

start-all.sh

5. After checking with jps, the problem is solved.


The above are the steps I took to solve the problem. I hope it can help you. If there is anything unclear, please leave a message.

Guess you like

Origin blog.csdn.net/m0_61232019/article/details/129324464