【问题标题】:When is hdfs-site.xml loaded by hadoop?hadoop什么时候加载hdfs-site.xml?
【发布时间】:2015-04-08 22:18:20
【问题描述】:

我的系统中安装了 hive 和 hadoop。

这是我的 hdfs-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
</configuration>

如果我执行 bin/start-all.sh 并转到我的配置单元并运行选择查询,我会收到错误:

The ratio of reported blocks 0.0000 has not reached the threshold 0.9990. Safe mode will be turned off automatically.

如果我等待一段时间并再次运行 hive 查询,它会起作用。

我读到安全模式阈值是使用属性设置的:dfs.namenode.safemode.threshold-pct

我在 hdfs-site.xml 中添加了该属性

<property>
     <name>dfs.namenode.safemode.threshold-pct</name>
     <value>0.500f</value>
</property>

我再次启动了所有 hadoop 节点,并运行 hive 查询,但我仍然遇到同样的错误

The ratio of reported blocks 0.0000 has not reached the threshold 0.9990. Safe mode will 

这意味着要么我的 xml 错误,要么我必须执行其他操作才能实际加载 hdfs-site.xml。

谁能告诉我我做错了什么?

【问题讨论】:

  • 更改后是否重启了hadoop。
  • 您的集群中有多少个数据节点?
  • 是的,我已经重新启动了。我在伪分布式模式下运行 1 个数据节点

标签: hadoop hive hdfs


【解决方案1】:

我做错了。我检查了 src 文件夹中的 hdfs-default.xml 并找到了这个

<property>
<name>dfs.safemode.threshold.pct</name>
<value>0.999f</value>
<description>
Specifies the percentage of blocks that should satisfy 
the minimal replication requirement defined by dfs.replication.min.
Values less than or equal to 0 mean not to start in safe mode.
Values greater than 1 will make safe mode permanent.
</description>
</property>

我认为我正在使用旧版本的 hadoop,因为 dfs.safemode.threshold.pct 已被弃用。

修改了我的hdfs-site.xml,停止并启动了namenode

<property>
<name>dfs.safemode.threshold.pct</name>
<value>2</value>
</property>

它成功了!

The ratio of reported blocks 0.0000 has not reached the threshold 2.0000. Safe mode will be turned off automatically.

【讨论】:

    猜你喜欢
    • 2018-05-21
    • 1970-01-01
    • 1970-01-01
    • 2021-01-19
    • 1970-01-01
    • 2022-06-25
    • 2013-02-27
    • 2011-11-25
    • 1970-01-01
    相关资源
    最近更新 更多