2 回答
TA贡献2036条经验 获得超8个赞
您需要确保已添加了一个环境变量HADOOP_CONF_DIR,该变量被调用以设置到包含来自 Hadoop 的 XML 文件的目录中。
您可以.bashrc在主文件夹中执行此操作
否则,您将获得默认文件系统 ,file://它仍然有效并且仍然可以正常运行 MapReduce 作业
FWIW,这是我的核心站点
$ cat /usr/local/Cellar/hadoop/3.1.1/libexec/etc/hadoop/core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>file:///tmp/hadoop/hdfs/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
和 hdfs 站点
$ cat /usr/local/Cellar/hadoop/3.1.1/libexec/etc/hadoop/hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///tmp/hadoop/hdfs/names</value>
</property>
<property>
<name>fs.checkpoint.dir</name>
<value>file:///tmp/hadoop/hdfs/checkpoint</value>
</property>
<property>
<name>fs.checkpoint.edits.dir</name>
<value>file:///tmp/hadoop/hdfs/checkpoint-edits</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///tmp/hadoop/hdfs/data</value>
</property>
</configuration>
TA贡献1900条经验 获得超5个赞
在 core-site.xml 文件中进行如下编辑。
<value>hdfs://localhost.localdomain:8020/</value>
我相信缺少斜线 (8020/) 会造成这个问题。尝试一下。
添加回答
举报