何时由hadoop加载hdfs-site.xml?

时间:2013-07-01 16:37:56

标签: hadoop hive hdfs

我的系统中安装了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并转到我的配置单元并运行select查询,我会收到错误:

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

如果我等待一段时间并再次运行配置单元查询,则可以正常工作。

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

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

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

我再次启动所有hadoop节点,并运行配置单元查询,但我仍然得到相同的错误

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

这意味着我的xml错误,或者我必须做其他事情来实际加载hdfs-site.xml。

有人能告诉我我做错了吗?

1 个答案:

答案 0 :(得分:0)

我犯了一个错误。我检查了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.
相关问题