阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Hadoop2.2.0 NN HA详细配置+Client透明性试验【完整版】

205次阅读
没有评论

共计 19202 个字符,预计需要花费 49 分钟才能阅读完成。

引言:
前面转载过一篇团队兄弟【伊利丹】写的 NN HA 实验记录,我也基于他的环境实验了 NN HA 对于 Client 的透明性。见 http://www.linuxidc.com/Linux/2014-09/106290.htm
本篇文章记录的是亲自配置 NN HA 的详细全过程,以及全面测试 HA 对客户端访问透明性的全过程,希望对大家有帮助。

实验环境
Hadoop2.2.0 的 4 节点集群,ZK 节点 3 个(ZK 节点数最好为奇数个),hosts 文件和各节点角色分配如下:
 
hosts
192.168.66.91 master
192.168.66.92 slave1
192.168.66.93 slave2
192.168.66.94 slave3
 
角色分配
 Active NNStandby NNDNJournalNodeZookeeperFailoverController
masterV  VVV
slave1 VVVVV
slave2  VVV 
slave3  V   
 

——————————————————————————–

Ubuntu 13.04 上搭建 Hadoop 环境 http://www.linuxidc.com/Linux/2013-06/86106.htm

Ubuntu 12.10 +Hadoop 1.2.1 版本集群配置 http://www.linuxidc.com/Linux/2013-09/90600.htm

Ubuntu 上搭建 Hadoop 环境(单机模式 + 伪分布模式)http://www.linuxidc.com/Linux/2013-01/77681.htm

Ubuntu 下 Hadoop 环境的配置 http://www.linuxidc.com/Linux/2012-11/74539.htm

单机版搭建 Hadoop 环境图文教程详解 http://www.linuxidc.com/Linux/2012-02/53927.htm

搭建 Hadoop 环境(在 Winodws 环境下用虚拟机虚拟两个 Ubuntu 系统进行搭建)http://www.linuxidc.com/Linux/2011-12/48894.htm

——————————————————————————–

实验过程:

1. 下载稳定版 Zookeeper

http://mirrors.cnnic.cn/apache/zookeeper/stable/
并解压到 hadoop 集群某目录下,我放在了 /home/yarn/ 下。

2. 修改配置文件
配置文件在 conf 文件夹中,将 zoo_sample.cfg 改名为 zoo.cfg,并对其做响应修改,以下是修改过后的 zoo.cfg
# The number of milliseconds of each tick ZK 之间,或者 Client 和 ZK 之间心跳的时间间隔
tickTime=2000
 
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
 
# the directory where the snapshot is stored. 
# do not use /tmp for storage, /tmp here is just 
# example sakes.  保存 ZK 数据的目录,请自行创建后在此处指定
dataDir=/home/yarn/Zookeeper/zoodata
 
# the port at which the clients will connect  客户端连接 ZK 服务器的端口
clientPort=2181
 
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to “0” to disable auto purge feature
#autopurge.purgeInterval=1
 
# 保存 ZK 日志的目录,请自行创建后在此处指定
dataLogDir=/home/yarn/Zookeeper/zoolog
 
#****** 以下部分均为分布式 ZK 集群使用 ******
#ZK 集群初始化时,Follower 节点需要和 Leader 节点通信,initLimit 配置的是 Leader最多等待多少个心跳
initLimit=5 
 
#Leader 和 Follower 之间发送消息、请求和应答时,最多等待多少个心跳
syncLimit=2 
 
#server.A=B:C:D
# A 是一个数字,表示这是第几号服务器
#B 是当前服务器的 ID 或者主机名
#C 是 Follower 服务器与 Leader 服务器交换信息的端口
#D 是当 Leader 挂掉时,重新选举 Leader 所使用的端口
server.1=192.168.66.91:2888:3888 
server.2=192.168.66.92:2888:3888
server.3=192.168.66.93:2888:3888
# 千万注意:接下来需要在各个几点的dataDir 目录下建立 myid 文件,内容就是相应的 A,也就是说,各个 ZK 节点的 myid 文件内容不同 !!!

3. 修改各个节点的环境变量
在 /etc/profile 文件添加:
export ZOOKEEPER_HOME=/home/yarn/Zookeeper/zookeeper-3.4.6
并为 PATH 加上
$ZOOKEEPER_HOME/bin
注意:export ZOOKEEPER_HOME 要在 PATH 的上方。

下面开始修改 Hadoop 的配置文件:

4. 修改 core-site.xml
<configuration>
<property>
  <name>fs.defaultFS</name>
  <value>hdfs://myhadoop</value>
  <description>注意:myhadoop 为集群的逻辑名,需与 hdfs-site.xml 中的 dfs.nameservices 一致!</description>
</property>
<property>
  <name>hadoop.tmp.dir</name>
  <value>/home/yarn/Hadoop/hdfs2.0/tmp</value>
</property>
<property>
  <name>ha.zookeeper.quorum</name>
  <value>master:2181,slave1:2181,slave2:2181</value>
  <description> 各个 ZK 节点的 IP/host,及客户端连接 ZK 的端口,该端口需与 zoo.cfg 中的clientPort 一致!</description>
</property>
</configuration>

5. 修改 hdfs-site.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<?xml-stylesheet type=”text/xsl” href=”https://www.linuxidc.com/Linux/2014-09/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>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.namenode.name.dir</name>
  <value>file:///home/yarn/Hadoop/hdfs2.0/name</value>
  <description>Determines where on the local filesystem the DFS name node
      should store the name table(fsimage).  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.namenode.shared.edits.dir</name>
  <value>qjournal://slave1:8485;slave2:8485;slave3: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>
 
<property>
  <name>dfs.datanode.data.dir</name>
  <value>file:///home/yarn/Hadoop/hdfs2.0/data</value>
  <description>Determines where on the local filesystem an DFS data node
  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.
  Directories that do not exist are ignored.
  </description>
</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.journalnode.edits.dir</name>
  <value>/home/yarn/Hadoop/hdfs2.0/journal/</value>
</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.namenode.handler.count</name>  
  <value>8</value>  
</property> 
 
</configuration>

更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2014-09/106292p2.htm

6. 将修改好的 core-site.xml 和 hdfs-site.xml 拷贝到各个 Hadoop 节点。


7. 启动
(1)启动 ZK
在所有的 ZK 节点执行命令:
zkServer.sh start
 
查看各个 ZK 的从属关系:
yarn@master:~$ zkServer.sh status
JMX enabled by default
Using config: /home/yarn/Zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
 
yarn@slave1:~$ zkServer.sh status
JMX enabled by default
Using config: /home/yarn/Zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
 
yarn@slave2:~$ zkServer.sh status
JMX enabled by default
Using config: /home/yarn/Zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: leader
 
注意:
哪个 ZK 节点会成为 leader 是随机的,第一次实验时 slave2 成为了 leader,第二次实验时 slave1 成为了 leader!
 
此时,在各个节点都可以查看到 ZK 进程:
yarn@master:~$ jps
3084 QuorumPeerMain
3212 Jps
 
(2)格式化 ZK(仅第一次需要做
任意 ZK 节点上执行:
hdfs zkfc -formatZK
 
(3)启动 ZKFC
ZookeeperFailoverController 是用来监控 NN 状态,协助实现主备 NN 切换的,所以仅仅在主备 NN 节点上启动就行:
hadoop-daemon.sh start zkfc
 
启动后我们可以看到 ZKFC 进程:
yarn@master:~$ jps
3084 QuorumPeerMain
3292 Jps
3247 DFSZKFailoverController
 
(4)启动用于主备 NN 之间同步元数据信息的共享存储系统JournalNode
参见角色分配表,在各个 JN 节点上启动:
hadoop-daemon.sh start journalnode
 
启动后在各个 JN 节点都可以看到 JournalNode 进程:
yarn@master:~$ jps
3084 QuorumPeerMain
3358 Jps
3325 JournalNode
3247 DFSZKFailoverController
 
(5)格式化并启动 主 NN
格式化:
hdfs namenode -format
注意:只有第一次启动系统时需格式化,请勿重复格式化!
 
主 NN 节点 执行命令启动 NN:
hadoop-daemon.sh start namenode
 
启动后可以看到 NN 进程:
yarn@master:~$ jps
3084 QuorumPeerMain
3480 Jps
3325 JournalNode
3411 NameNode
3247 DFSZKFailoverController
 
 
(6)在 备 NN上同步主 NN 的元数据信息
hdfs namenode -bootstrapStandby
 
以下是正常执行时的最后部分日志:
Re-format filesystem in Storage Directory /home/yarn/Hadoop/hdfs2.0/name ? (Y or N) Y
14/06/15 10:09:08 INFO common.Storage: Storage directory /home/yarn/Hadoop/hdfs2.0/name has been successfully formatted.
14/06/15 10:09:09 INFO namenode.TransferFsImage: Opening connection to http://master:50070/getimage?getimage=1&txid=935&storageInfo=-47:564636372:0:CID-d899b10e-10c9-4851-b60d-3e158e322a62
14/06/15 10:09:09 INFO namenode.TransferFsImage: Transfer took 0.11s at 63.64 KB/s
14/06/15 10:09:09 INFO namenode.TransferFsImage: Downloaded file fsimage.ckpt_0000000000000000935 size 7545 bytes.
14/06/15 10:09:09 INFO util.ExitUtil: Exiting with status 0
14/06/15 10:09:09 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at slave1/192.168.66.92
************************************************************/
 
(7)启动备 NN
在备 NN 上执行命令:
hadoop-daemon.sh start namenode
 
(8)设置主 NN(这一步可以省略,这是在设置手动切换 NN 时的步骤,ZK 已经自动选择一个节点作为主 NN 了)
到目前为止,其实 HDFS 还不知道谁是主 NN,可以通过监控页面查看,两个节点的 NN 都是 Standby 状态。
下面我们需要在主 NN 节点上执行命令激活主 NN:
hdfs haadmin -transitionToActive nn1
 
(9)在主 NN 上启动 Datanode
在 [nn1] 上,启动所有 datanode
hadoop-daemons.sh start datanode

8. 效果验证 1 – 主备自动切换

目前的主 NN 是 192.168.0.91
Hadoop2.2.0 NN HA 详细配置 +Client 透明性试验【完整版】
 
备 NN 是 192.168.0.92
 
Hadoop2.2.0 NN HA 详细配置 +Client 透明性试验【完整版】
我在主 NN 上 kill 掉 NameNode 进程:
yarn@master:~$ jps
5161 NameNode
5085 JournalNode
5438 Jps
4987 DFSZKFailoverController
4904 QuorumPeerMain
yarn@master:~$ kill 5161
yarn@master:~$ jps
5451 Jps
5085 JournalNode
4987 DFSZKFailoverController
4904 QuorumPeerMain
 
此时,主 NN 监控页面无法访问:
Hadoop2.2.0 NN HA 详细配置 +Client 透明性试验【完整版】
备 NN 自动切换为主 NN:
 
 Hadoop2.2.0 NN HA 详细配置 +Client 透明性试验【完整版】

9. 效果验证 2 –HA 对 shell 的透明性
访问逻辑名 myhadoop,执行命令查看目录结构,不受影响:
yarn@slave3:~$ hadoop dfs -ls hdfs://myhadoop/
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.
 
Found 3 items
drwxr-xr-x   – yarn supergroup          0 2014-03-20 00:10 hdfs://myhadoop/home
drwxrwx—   – yarn supergroup          0 2014-03-17 20:11 hdfs://myhadoop/tmp
drwxr-xr-x   – yarn supergroup          0 2014-03-17 20:15 hdfs://myhadoop/workspace

10. 效果验证 3 –HA 对 Client 程序的透明性

使用自己写的 HdfsDAO.java 测试,程序中将指向 HDFS 的 path 设置为:
private static final String HDFS = “hdfs://myhadoop/”;
先 ping myhadoop 确保没有配置 hosts,然后运行程序,一切正常:
yarn@master:~$ ping myhadoop
ping: unknown host myhadoop
yarn@master:~$ hadoop jar Desktop/hatest.jar HdfsDAO 
ls: /
==========================================================
name: hdfs://myhadoop/home, folder: true, size: 0
name: hdfs://myhadoop/tmp, folder: true, size: 0
name: hdfs://myhadoop/workspace, folder: true, size: 0
==========================================================

更多 Hadoop 相关信息见Hadoop 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=13

引言:
前面转载过一篇团队兄弟【伊利丹】写的 NN HA 实验记录,我也基于他的环境实验了 NN HA 对于 Client 的透明性。见 http://www.linuxidc.com/Linux/2014-09/106290.htm
本篇文章记录的是亲自配置 NN HA 的详细全过程,以及全面测试 HA 对客户端访问透明性的全过程,希望对大家有帮助。

实验环境
Hadoop2.2.0 的 4 节点集群,ZK 节点 3 个(ZK 节点数最好为奇数个),hosts 文件和各节点角色分配如下:
 
hosts
192.168.66.91 master
192.168.66.92 slave1
192.168.66.93 slave2
192.168.66.94 slave3
 
角色分配
 Active NNStandby NNDNJournalNodeZookeeperFailoverController
masterV  VVV
slave1 VVVVV
slave2  VVV 
slave3  V   
 

——————————————————————————–

Ubuntu 13.04 上搭建 Hadoop 环境 http://www.linuxidc.com/Linux/2013-06/86106.htm

Ubuntu 12.10 +Hadoop 1.2.1 版本集群配置 http://www.linuxidc.com/Linux/2013-09/90600.htm

Ubuntu 上搭建 Hadoop 环境(单机模式 + 伪分布模式)http://www.linuxidc.com/Linux/2013-01/77681.htm

Ubuntu 下 Hadoop 环境的配置 http://www.linuxidc.com/Linux/2012-11/74539.htm

单机版搭建 Hadoop 环境图文教程详解 http://www.linuxidc.com/Linux/2012-02/53927.htm

搭建 Hadoop 环境(在 Winodws 环境下用虚拟机虚拟两个 Ubuntu 系统进行搭建)http://www.linuxidc.com/Linux/2011-12/48894.htm

——————————————————————————–

实验过程:

1. 下载稳定版 Zookeeper

http://mirrors.cnnic.cn/apache/zookeeper/stable/
并解压到 hadoop 集群某目录下,我放在了 /home/yarn/ 下。

2. 修改配置文件
配置文件在 conf 文件夹中,将 zoo_sample.cfg 改名为 zoo.cfg,并对其做响应修改,以下是修改过后的 zoo.cfg
# The number of milliseconds of each tick ZK 之间,或者 Client 和 ZK 之间心跳的时间间隔
tickTime=2000
 
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
 
# the directory where the snapshot is stored. 
# do not use /tmp for storage, /tmp here is just 
# example sakes.  保存 ZK 数据的目录,请自行创建后在此处指定
dataDir=/home/yarn/Zookeeper/zoodata
 
# the port at which the clients will connect  客户端连接 ZK 服务器的端口
clientPort=2181
 
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to “0” to disable auto purge feature
#autopurge.purgeInterval=1
 
# 保存 ZK 日志的目录,请自行创建后在此处指定
dataLogDir=/home/yarn/Zookeeper/zoolog
 
#****** 以下部分均为分布式 ZK 集群使用 ******
#ZK 集群初始化时,Follower 节点需要和 Leader 节点通信,initLimit 配置的是 Leader最多等待多少个心跳
initLimit=5 
 
#Leader 和 Follower 之间发送消息、请求和应答时,最多等待多少个心跳
syncLimit=2 
 
#server.A=B:C:D
# A 是一个数字,表示这是第几号服务器
#B 是当前服务器的 ID 或者主机名
#C 是 Follower 服务器与 Leader 服务器交换信息的端口
#D 是当 Leader 挂掉时,重新选举 Leader 所使用的端口
server.1=192.168.66.91:2888:3888 
server.2=192.168.66.92:2888:3888
server.3=192.168.66.93:2888:3888
# 千万注意:接下来需要在各个几点的dataDir 目录下建立 myid 文件,内容就是相应的 A,也就是说,各个 ZK 节点的 myid 文件内容不同 !!!

3. 修改各个节点的环境变量
在 /etc/profile 文件添加:
export ZOOKEEPER_HOME=/home/yarn/Zookeeper/zookeeper-3.4.6
并为 PATH 加上
$ZOOKEEPER_HOME/bin
注意:export ZOOKEEPER_HOME 要在 PATH 的上方。

下面开始修改 Hadoop 的配置文件:

4. 修改 core-site.xml
<configuration>
<property>
  <name>fs.defaultFS</name>
  <value>hdfs://myhadoop</value>
  <description>注意:myhadoop 为集群的逻辑名,需与 hdfs-site.xml 中的 dfs.nameservices 一致!</description>
</property>
<property>
  <name>hadoop.tmp.dir</name>
  <value>/home/yarn/Hadoop/hdfs2.0/tmp</value>
</property>
<property>
  <name>ha.zookeeper.quorum</name>
  <value>master:2181,slave1:2181,slave2:2181</value>
  <description> 各个 ZK 节点的 IP/host,及客户端连接 ZK 的端口,该端口需与 zoo.cfg 中的clientPort 一致!</description>
</property>
</configuration>

5. 修改 hdfs-site.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<?xml-stylesheet type=”text/xsl” href=”https://www.linuxidc.com/Linux/2014-09/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>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.namenode.name.dir</name>
  <value>file:///home/yarn/Hadoop/hdfs2.0/name</value>
  <description>Determines where on the local filesystem the DFS name node
      should store the name table(fsimage).  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.namenode.shared.edits.dir</name>
  <value>qjournal://slave1:8485;slave2:8485;slave3: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>
 
<property>
  <name>dfs.datanode.data.dir</name>
  <value>file:///home/yarn/Hadoop/hdfs2.0/data</value>
  <description>Determines where on the local filesystem an DFS data node
  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.
  Directories that do not exist are ignored.
  </description>
</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.journalnode.edits.dir</name>
  <value>/home/yarn/Hadoop/hdfs2.0/journal/</value>
</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.namenode.handler.count</name>  
  <value>8</value>  
</property> 
 
</configuration>

更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2014-09/106292p2.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计19202字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中