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?
Namenode in safe mode means, Hadoop is in read-only mode. At this point, Hadoop won’t allow any files to be written/append into HDFS, i.e., no changes are allowed in HDFS. So, if we try to create a directory in HDFS, above error in question will be thrown.
Namenode enters into safemode when there is shortage of memory. As a result the HDFS becomes readable only. That means one can not create any additional directory or file in the HDFS. To come out of the safemode, the following command is used: But it doesn't always solve the problem. The complete solution lies in making some space in the memory.
That means we can not create any additional directory or file in the HDFS, as it may effect replication of files due to less storage. Secondly, during start up Namenode loads the filesystem state from fsimage and edits log file.
hadoop dfsadmin has been deprecated and so is hadoop fs command, all hdfs related tasks are being moved to a separate command hdfs. Basically namenode enters in safe mode in unusual situations, for example when disk is full, also in the start-up phase. Read more here; hadoop.apache.org/docs/stable/hdfs_user_guide.html#Safemode
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With