格式化namenode时报错警告:WARN common.Util: Path /data/dfs/name should be specified as a URI in configuration

一、问题分析

在执行hadoop namenode格式化命令:bin/hadoop namenode -format时出现警告:

WARN common.Util: Path /data/dfs/name should be specified as a URI in configuration

这是问啥呢?

在hdfs-site.xml的配置如下:

<configuration>
        <property>
                <name>dfs.namenode.name.dir</name>
                <value>/data/dfs/name</value>
                <final>true</final>
        </property>
        <property>
                <name>dfs.datanode.data.dir</name>
                <value>/data/dfs/data</value>
                <final>true</final>
        </property>
        <property>
                <name>dfs.replication</name>
                <value>1</value>
        </property>
        <property>
                <name>dfs.permissions</name>
                <value>false</value>
        </property>
</configuration>

配置文件中指定了namenode的存储路径的呀,为啥出警告呢?

二、问题解决

原来是dfs.namenode.name.dir的路径不规范,即:不合规范的URI格式

我们修改配置文件为:

<configuration>
        <property>
                <name>dfs.namenode.name.dir</name>
                <value>file:///data/dfs/name</value>
                <final>true</final>
        </property>
        <property>
                <name>dfs.datanode.data.dir</name>
                <value>file:///data/dfs/data</value>
                <final>true</final>
        </property>
        <property>
                <name>dfs.replication</name>
                <value>1</value>
        </property>
        <property>
                <name>dfs.permissions</name>
                <value>false</value>
        </property>
</configuration>

再次执行namenode格式化命令,发现警告消失了,至此问题解决。

但是反过来我们思考,这个警告真的有必要解决吗?答案:不是的。

you can ignore the warning but if you want namenode location to be in HDFS then value should be: hdfs://p:ath/

 

转载自:https://my.oschina.net/wangbaofeng/blog/893509?utm_medium=referral

 posted on 2019-10-31 16:56  xibuhaohao  阅读(1743)  评论(0编辑  收藏  举报