引言:
前面转载过一篇团队兄弟【伊利丹】写的NN HA实验记录,我也基于他的环境实验了NN HA对于Client的透明性。
本篇文章记录的是亲自配置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 NN | Standby NN | DN | JournalNode | Zookeeper | FailoverController | |
master | V | V | V | V | ||
slave1 | V | V | V | V | V | |
slave2 | V | V | V | |||
slave3 | V |
实验过程:
并解压到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日志的目录,请自行创建后在此