SafeModeException : Name node is in safe mode
hadoop
Solution
NameNode is in safemode until configured percent of blocks reported to be online by the data nodes. It can be configured by parameter `dfs.namenode.safemode.threshold-pct` in the `hdfs-site.xml`
For small / development clusters, where you have very few blocks - it makes sense to make this parameter lower then its default `0.9999f` value. Otherwise 1 missing block can lead to system to hang in safemode.
Problem
I tried copying files from my local disk to `hdfs` . At first it gave `SafeModeException`. While searching for solution I read that the problem does not appear if one executes same command again. So I tried again and it didn't gave exception. ``` hduser@saket:/usr/local/hadoop$ bin/hadoop dfs -copyFromLocal /tmp/gutenberg/ /user/hduser/gutenberg copyFromLocal: org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create directory /user/hduser/gutenberg. Name node is in safe mode. hduser@saket:/usr/local/hadoop$ bin/hadoop dfs -copyFromLocal /tmp/gutenberg/ /user/hduser/gutenberg ``` Why is this happening?. Should I keep safemode off by using this code? ``` hadoop dfs -safemode leave ```