Cannot create directory in hdfs NameNode is in safe mode
Asked Answered
C

4

13

I upgrade to the latest version of cloudera.Now I am trying to create directory in HDFS

hadoop fs -mkdir data

Am getting the following error

Cannot Create /user/cloudera/data Name Node is in SafeMode.

How can I do this?

Cockcroft answered 10/6, 2017 at 3:30 Comment(0)
E
22

When you start hadoop, for some time limit hadoop stays in safemode. You can either wait (you can see the time limit being decreased on Namenode web UI) until the time limit or You can turn it off with

hadoop dfsadmin -safemode leave

The above command turns off the safemode of hadoop

Erinaceous answered 10/6, 2017 at 4:56 Comment(0)
K
8

In addition to Ramesh Maharjan answer, By default, cloudera machine(Cloudera Quick Start#5.12) doesn't allow to SET OFF safe mode, it's required to specify the -u options as shown below:

sudo -u hdfs hdfs dfsadmin -safemode leave
Katmandu answered 1/1, 2018 at 10:0 Comment(0)
S
1

For me, I was immediately using hive command to go into hive shell after starting hadoop using start-all.sh. I re-tried using hive command after waiting for 10-20 seconds.

Satellite answered 2/1, 2023 at 6:57 Comment(0)
G
-1

Might need the full path to hdfs command

/usr/local/hadoop/bin/hdfs dfsadmin -safemode leave
Gaslight answered 30/4, 2020 at 15:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.