hadoop 2.6.5 HA 分布式搭建

Ha模式是有两个namenode,一个NN(active),一个NN(standby),这样一个active的NN发生故障时standby的NN就可以转成active。
首先要搭建zookeeper。
将zookeeper的安装位置写在~/.bashrc
修改配置文件zoo.cfg
如下:

# The number of milliseconds of each tick
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.
dataDir=/usr/local/zookeeper/zookeeper-3.4.6/var/data
dataLogdir=/usr/local/zookeeper/zookpeer-3.4.6/var/logs
# the port at which the clients will connect
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
#
server.1=Master:2888:3888
server.2=Slave1:2888:3888
server.3=Slave2:2888:3888

在dataDir目录下建立myid文件,在对应的主机下的myid中写入相应的序号。(如在Master下的myid中写入1)
最后启动zookeeper

2、配置Hadoop
需要修改core-site.xml,hdfs-site.xml,mapred-site.xml,yarn-site.xml,还有slaves文件。
参考:http://eksliang.iteye.com/blog/2226986
http://blog.itpub.net/20777547/viewspace-1745820/(我是用这个配置的)

3、集群的启动
3.1 启动zookeeper集群
分别在master、slave1,slave2上执行下面命令:zkServer.sh start(可以查看zkServer.sh status命令,看是否有一个leader节点和两个follower节点)
3.2 启动journalnode集群
在主节点上(master)输入:sbin/hadoop-daemons.sh start journalnode
3.3 格式化zkfc
在主节点上(master)输入:hdfs zkfc –formatZK
3.4 格式化hdfs
在主节点上(master)输入:hadoop namenode –format
3.5 启动NameNode
在主节点上(master)输入: sbin/hadoop-daemon.sh start namenode
在备节点上(slave1)输入:

#把NameNode的数据同步到slave1上  
hdfs namenode –bootstrapStandby  
#启动slave1上的namenode作为standby  
sbin/hadoop-daemon.sh start namenode 

3.6启动datanode
在主节点上(master)输入:
sbin/hadoop-daemons.sh start datanode

3.7 启动yarn
在主节点上(master)输入:sbin/start-yarn.sh

3.8 启动ZKFC
在主节点上(master)输入: sbin/hadoop-daemons.sh start zkfc

注意:在那个节点上有zkfc的进程,则这个节点就是主节点。
HDFS haadmin -transitionToActive Master(Slave1)这里是主备节点的选择!

问题:每个节点上都启动zkfc服务了,为什么只有一个节点有zkfc的进程呢!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值