<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/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 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>
<!-- NN HA related configuration **BEGIN** -->
<property>
<name>dfs.nameservices</name>
<value>myhadoop</value>
<description>
Comma-separated list of nameservices.
as same as fs.defaultFS in core-site.xml.
</description>
</property>
<property>
<name>dfs.ha.namenodes.myhadoop</name>
<value>nn1,nn2</value>
<description>
The prefix for a given nameservice, contains a comma-separated
list of namenodes for a given nameservice (eg EXAMPLENAMESERVICE).
</description>
</property>
<property>
<name>dfs.namenode.rpc-address.myhadoop.nn1</name>
<value>master:8020</value>
<description>
RPC address for nomenode1 of hadoop-test
</description>
</property>
<property>
<name>dfs.namenode.rpc-address.myhadoop.nn2</name>
<value>slave1:8020</value>
<description>
RPC address for nomenode2 of hadoop-test
</description>
</property>
<property>
<name>dfs.namenode.http-address.myhadoop.nn1</name>
<value>master:50070</value>
<description>
The address and the base port where the dfs namenode1 web ui will listen
on.
</description>
</property>
<property>
<name>dfs.namenode.http-address.myhadoop.nn2</name>
<value>slave1:50070</value>
<description>
The address and the base port where the dfs namenode2 web ui will listen
on.
</description>
</property>
<property>
<name>dfs.namenode.servicerpc-address.myhadoop.n1</name>
<value>master:53310</value>
</property>
<property>
<name>dfs.namenode.servicerpc-address.myhadoop.n2</name>
<value>slave1:53310</value>
</property>
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
<description>
Whether automatic failover is enabled. See the HDFS High
Availability documentation for details on automatic HA
configuration.
</description>
</property>
<property>
<name>dfs.client.failover.proxy.provider.myhadoop</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider
</value>
<description>Configure the name of the Java class which will be used
by the DFS Client to determine which NameNode is the current Active,
and therefore which NameNode is currently serving client requests.
这个类是Client的访问代理,是HA特性对于Client透明的关键!
</description>
</property>
<property>
<name>dfs.ha.fencing.methods</name>
<value>sshfence</value>
<description>how to communicate in the switch process</description>
</property>
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/home/yarn/.ssh/id_rsa</value>
<description>the location stored ssh key</description>
</property>
<property>
<name>dfs.ha.fencing.ssh.connect-timeout</name>
<value>1000</value>
</property>
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/home/yarn/Hadoop/hadoop-2.4.1/hdfs_dir/journal/</value>
</property>
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://master:8485;slave1:8485;slave2:8485/hadoop-journal
</value>
<description>A directory on shared storage between the multiple
namenodes
in an HA cluster. This directory will be written by the active and read
by the standby in order to keep the namespaces synchronized. This
directory
does not need to be listed in dfs.namenode.edits.dir above. It should be
left empty in a non-HA cluster.
</description>
</property>
<!-- NN HA related configuration **END** -->
<!-- NameNode related configuration **BEGIN** -->
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///home/yarn/Hadoop/hadoop-2.4.1/hdfs_dir/name</value>
<description>Path on the local filesystem where the NameNode stores
the namespace and transactions logs persistently.If this is a
comma-delimited list of directories then the name table is replicated
in all of the directories, for redundancy.</description>
</property>
<property>
<name>dfs.blocksize</name>
<value>1048576</value>
<description>
HDFS blocksize of 128MB for large file-systems.
Minimum block size is 1048576.
</description>
</property>
<property>
<name>dfs.namenode.handler.count</name>
<value>10</value>
<description>More NameNode server threads to handle RPCs from large
number of DataNodes.</description>
</property>
<!-- <property> <name>dfs.namenode.hosts</name> <value>master</value> <description>If
necessary, use this to control the list of allowable datanodes.</description>
</property> <property> <name>dfs.namenode.hosts.exclude</name> <value>slave1,slave2,slave3</value>
<description>If necessary, use this to control the list of exclude datanodes.</description>
</property> -->
<!-- NameNode related configuration **END** -->
<!-- DataNode related configuration **BEGIN** -->
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///home/yarn/Hadoop/hadoop-2.4.1/hdfs_dir/data</value>
<description>Comma separated list of paths on the local filesystem of
a DataNode where it should store its blocks.If this is a
comma-delimited list of directories, then data will be stored in all
named directories, typically on different devices.</description>
</property>
<!-- DataNode related configuration **END** -->
</configuration>
--------------------------------------------------------------------------------
5.yarn-site.xml