Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
491 views
in Technique[技术] by (71.8m points)

hdfs 配制HA,只能访问到本地文件系统,为什么访问不到hdfs系统?

1.在bin/hdfs dfs 下执行命令访问到的是本地文件系统,正常来讲应该是hdfs文件系统
2.HA配置文件
<?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.nameservices</name>
  <value>ns1</value>
</property>

<property>
  <name>dfs.ha.namenodes.ns1</name>
  <value>nn1,nn2</value>
</property>
    
<property>
  <name>dfs.namenode.rpc-address.ns1.nn1</name>
  <value>localhostlei1:8020</value>
</property>
<property>
  <name>dfs.namenode.rpc-address.ns1.nn2</name>
  <value>localhostlei2:8020</value>
</property>
    
<property>
  <name>dfs.namenode.http-address.ns1.nn1</name>
  <value>localhostlei1:50070</value>
</property>
<property>
  <name>dfs.namenode.http-address.ns1.nn2</name>
  <value>localhostlei2:50070</value>
</property>

 <property>
  <name>dfs.namenode.shared.edits.dir</name>
  <value>qjournal://localhostlei1:8485;localhostlei2:8485;localhostlei3:8485/ns1</value>
 </property>
 
<property>
  <name>dfs.journalnode.edits.dir</name>
  <value>/path/to/journal/node/local/data</value>
</property>

<property>
 <name>dfs.client.failover.proxy.provider.ns1</name>
 <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>

<property>
<name>dfs.ha.fencing.methods</name>
<value>sshfence</value>

</property>

<property>

  <name>dfs.ha.fencing.ssh.private-key-files</name>
  <value>/home/lei/.ssh/id_rsa</value>
</property>

<property>
  <name>fs.defaultFS</name>
  <value>hdfs://ns1</value>
</property>

<property>

  <name>dfs.permissions</name>
  <value>false</value>

</property>
</configuration>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

这个配置应该在core-site.xml文件中
<property>
<name>fs.defaultFS</name>
<value>hdfs://ns1</value>
</property>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...