1
votes

I'm a hadoop green hand, I try install hadoop3.0 in my vm, after I config hadoop, and then try :

hdfs namenode ‐format

and got output:

2017-12-26 00:20:56,255 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = localhost/127.0.0.1
STARTUP_MSG:   args = [‐format]
STARTUP_MSG:   version = 3.0.0
STARTUP_MSG:   classpath = /opt/hadoop-3.0.0/etc/hadoop:/opt/hadoop-3.0.0/share/hadoop/common/lib/xz-1.0.jar:/opt/hadoop-3.0.0/share/hadoop/common/lib/kerby-util-1.0.1.jar:   .............   hadoop-yarn-applications-unmanaged-am-launcher-3.0.0.jar:/opt/hadoop-3.0.0/share/hadoop/yarn/hadoop-yarn-registry-3.0.0.jar
STARTUP_MSG:   build = https://git-wip-us.apache.org/repos/asf/hadoop.git -r c25427ceca461ee979d30edd7a4b0f50718e6533; compiled by 'andrew' on 2017-12-08T19:16Z
STARTUP_MSG:   java = 1.8.0_151
************************************************************/
2017-12-26 00:20:56,265 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
2017-12-26 00:20:56,269 INFO namenode.NameNode: createNameNode [‐format]
Usage: hdfs namenode [-backup] | 
        [-checkpoint] | 
        [-format [-clusterid cid ] [-force] [-nonInteractive] ] | 
        [-upgrade [-clusterid cid] [-renameReserved<k-v pairs>] ] | 
        [-upgradeOnly [-clusterid cid] [-renameReserved<k-v pairs>] ] | 
        [-rollback] | 
        [-rollingUpgrade <rollback|started> ] | 
        [-importCheckpoint] | 
        [-initializeSharedEdits] | 
        [-bootstrapStandby [-force] [-nonInteractive] [-skipSharedEditsCheck] ] | 
        [-recover [ -force] ] | 
        [-metadataVersion ]

2017-12-26 00:20:56,365 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at localhost/127.0.0.1
************************************************************/

I config hdfs-site.xml as follow:

<configuration>

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

  <property>
    <name>dfs.namenode.name.dir</name>
    <value>/home/dan/hadoop_data/namenode</value>
  </property>
  <property>
    <name>dfs.datanode.data.dir</name>
    <value>/home/dan/hadoop_data/datanode</value>
  </property>

</configuration>

when I start namenode service, it fail and log tell : 2017-12-26 00:03:41,331 INFO org.apache.hadoop.util.ExitUtil: Exiting with status 1: java.io.IOException: NameNode is not formatted. 2017-12-26 00:03:41,337 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: SHUTDOWN_MSG:

Can anyone tell me to fix this issue?

Thanks in advance!

1

1 Answers

1
votes

Solution 1:

Sometimes It happens. First, stop all service and just go to your current directory and delete current directory. Hadoop current directory stores all logs files as well. By removing current directory start all service again.

Stop all service :

$HADOOP_HOME/sbin/stop-all.sh

After stop all service once you should format Namenode by the following command.

Format name node:

$HADOOP_HOME/bin/hadoop namenode –format

Now again start all service by following command.

Start all service:

$HADOOP_HOME/sbin/start-all.sh

Solution 2:

Sometimes Namenode went into safe-mode. You need to leave safe node by following command.

$HADOOP_HOME/bin/hdfs dfsadmin -safemode leave