core-site.xml 配置
<configuration>
?<property>?
<name>fs.defaultFS</name>
? <value>hdfs://mycluster</value>?
</property>
?<property>
<!---fsimage and edits-->
? <name>hadoop.tmp.dir</name>
? <value>/usr/local/hadoop-2.5.1/tmp</value>
?</property>
?<property>
? <name>hadoop.http.staticuser.user</name>
? <value>root</value>
?</property>?
<property>
? <name>ha.ZooKeeper.quorum</name>?
<value>masternode,standbyNN,slave</value>
?</property>?
</configuration>
hdfs-site.xml 配置
<configuration>
<property>
<name>dfs.nameservices</name>
<value>mycluster</value>
</property>
<property>
<name>dfs.ha.namenodes.mycluster</name>
<value>nn1,nn2</value>
</property>
<!--rpc 通讯端口-->
<property>
<name>dfs.namenode.rpc-address.mycluster.nn1</name>
<value>masternode:8020</value>
</property>
<property>
<name>dfs.namenode.rpc-address.mycluster.nn2</name>
<value>standbyNN:8020</value>
</property>
<!--web 访问端口-->
<property>
<name>dfs.namenode.http-address.mycluster.nn1</name>
<value>masternode:50070</value>
</property>
<property>
<name>dfs.namenode.http-address.mycluster.nn2</name>
<value>standbyNN:50070</value>
</property>
<!--用于共享编辑日志的journal节点列表-->
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://masternode:8485;standbyNN:8485;slave:8485/mycluster</value>
</property>
<property>
<name>dfs.client.failover.proxy.provider.mycluster</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>/root/.ssh/id_rsa</value>
</property>
<!--journalnode 上用于存放edits日志的目录-->
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/opt/journalnode/data</value>
</property>
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
</configuration>
原文:https://www.cnblogs.com/jzsg/p/12622214.html