Format and Start HDFS
Modify the JAVA_HOME value in the
hadoop-env.sh
file:export JAVA_HOME=/usr/java/default
Execute the following commands on the NameNode host machine:
su - $HDFS_USER /usr/hdp/current/hadoop-hdfs-namenode/bin/hdfs namenode -format /usr/hdp/current/hadoop-client/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR start namenode
Execute the following commands on the SecondaryNameNode:
su - $HDFS_USER /usr/hdp/current/hadoop-client/sbin /hadoop-daemon.sh --config $HADOOP_CONF_DIR start secondarynamenode
Execute the following commands on all DataNodes:
su - $HDFS_USER /usr/hdp/current/hadoop-hdfs-datanode/../hadoop/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR start datanode
Where $HADOOP_CONF_DIR is the directory for storing the Hadoop configuration files. For example,
/etc/hadoop/conf
.Where $HDFS_USER is the HDFS user, for example,
hdfs
.