SafeModeException:名称节点处于安全模式 [英] SafeModeException : Name node is in safe mode

查看:525
本文介绍了SafeModeException:名称节点处于安全模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将文件从本地磁盘复制到 hdfs 。起初它给了 SafeModeException 。在搜索解决方案时,我发现如果再次执行相同的命令,问题不会出现。所以我再次尝试,并没有给出异常。

  hduser @ saket:/ usr / local / hadoop $ bin / hadoop dfs -copyFromLocal / tmp / gutenberg / / user / hduser / gutenberg 
copyFromLocal:org.apache.hadoop.hdfs.server.namenode.SafeModeException:无法创建目录/ user / hduser / gutenberg。名称节点处于安全模式。
hduser @ saket:/ usr / local / hadoop $ bin / hadoop dfs -copyFromLocal / tmp / gutenberg / / user / hduser / gutenberg

为什么会发生这种情况?我应该使用这段代码保持安全模式吗?

  hadoop dfs -safemode leave 

NameNode 位于 safemode 报告数据节点在线的块。它可以通过 hdfs-site.xml 中的参数 dfs.namenode.safemode.threshold-pct p>

对于小块/开发群集,只有很少块的情况下 - 将此参数设置为低于其默认值 0.9999f

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

解决方案

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.

这篇关于SafeModeException:名称节点处于安全模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆