hadoop 3 文件无法提交 9000端口无法访问的原因

网络上很多配置的core-site.xml是这么写的

    <property>
        <name>fs.defaultFS</name>
        <!-- hserver1为当前机器名或者ip号 -->
        <value>hdfs://hserver1:9000</value>
    </property>

然后运行的结果就是无法提交文件,开始处理为啥9000端口无法访问的问题....但是9000是单机的端口,集群模式要写nameNode的IP和端口,例如hdfs://hserver1:8020或是hdfs://192.168.100.11:8020或是直接写hdfs://cluster,这个cluster是对应hdfs-site.xml里的

<property>
        <name>dfs.nameservices</name>
        <value>cluster</value>
 </property>

重启hadoop运行(要先创建test.txt文件)

hdfs dfs -mkdir /input
hdfs dfs -put /tmp-hadoop/data/test.txt /input
hdfs dfs -ls /input

hadoop 3 文件无法提交 9000端口无法访问的原因