Hbase是运行在hadoop之上,所以请参考第3篇文章搭建好一个master,两个slave的hadoop环境,我采用的版本为hadoop2.7.4

不了解Hbase的同学可以参考下这篇文章,分析得相当深刻,感谢作者 http://blog.csdn.net/u010270403/article/details/51648462

为啥在安装Hbase前需要安装zookeeper?

1,hbase regionserver 向zookeeper注册,提供hbase regionserver状态信息(是否在线)

2,hmaster启动时候会将hbase 系统表-ROOT- 加载到 zookeeper cluster,通过zookeeper cluster可以获取当前系统表.META.的存储所对应的regionserver信息。

注意:zookeeper集群节点最少3台,这样才能满足选举规则,少数服从多数

忘了讲一个问题

集群中,所有节点的时间同步非常重要,所以要将所有节点的时间设置为一样,

当然,手动设置时间肯定不行,需要用到ntp来自动同步

#设置时区为上海
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #安装ntp
yum -y install ntp # 同步时间
ntpdate pool.ntp.org #确认时间是否正确
date #写回bios,防止重启后失效
hwclock -w

现在master节点上配置,配置好后复制到两个slave节点就好了

wget http://mirror.bit.edu.cn/apache/zookeeper/current/zookeeper-3.4.10.tar.gz

tar -zxvf zookeeper-3.4.10.tar.gz 

#进入conf目录
cp -p zoo_sample.cfg zoo.cfg #编辑cfg文件
vi 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=/home/dataDir/zookeeper
#事物日志的存储路径,不配置会产生性能问题
dataLogDir=/home/dataDir/zookeeperDataLog
# 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 # # 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 server.1=master:2888:3888 server.2=slave1:2888:3888 server.3=slave2:2888:3888
#所有节点
mkdir -p /home/dataDir/zookeeper
#master
echo "1" > /home/dataDir/zookeeper/myid #slave1
echo "2" > /home/dataDir/zookeeper/myid #slave2
echo "3" > /home/dataDir/zookeeper/myid #启动
/home/zookeeper-3.4.10/bin/zkServer.sh start /home/zookeeper-3.4.10/conf/zoo.cfg #状态查看
[root@master conf]# /home/zookeeper-3.4.10/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower
[root@master conf]# #如果启动失败,查看日志
less zookeeper.out #停止服务
[root@master conf]# /home/zookeeper-3.4.10/bin/zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /home/zookeeper-3.4.10/bin/../conf/zoo.cfg Stopping zookeeper ... STOPPED
[root@master conf]# jps
3589 Jps
[root@master conf]#

找到leader节点,并停掉,你会发现刚开始为follower的某个节点又变为leader了

至此zookeeper配置完成

发现了一篇详细介绍zookeeper的系列好文 http://www.cnblogs.com/sunddenly/category/620563.html

最新文章

  1. 《微信小程序七日谈》- 第一天:人生若只如初见
  2. javascript数组浅谈3
  3. Git 常用命令详解(二)
  4. XP 之后, Delphi 动注册表不方便了...逼出来一个办法:
  5. ormlite性能对比
  6. IE6常见bug整理
  7. coco2d学习day01 精灵分析
  8. android 访问SMS短信收件箱
  9. [cocos2d-x 2.0.4][iOS7]不能全屏问题
  10. linux下修改防火墙端口对外开放方法
  11. [LeetCode]题解(python):022-Generate Parentheses
  12. 彻底搞定c指针
  13. IIS安装教程
  14. Android 加载GIF图最佳实践
  15. js异步编程终级解决方案 async/await
  16. 浅谈Phoenix在HBase中的应用
  17. 安装mysql 初始化的时候报错 Can't find file: './mysql/db.frm' (errno: 13) ERROR: 1017
  18. POJ1611(KB2-B)
  19. 第三周 构造一个简单的Linux系统MenuOS
  20. avalonJS-源码阅读(2)

热门文章

  1. 第一个C#语言
  2. delphi 中的win32 以外到平台的字符串处理一定慢吗?(转载)
  3. 69.查看APP沙盒缓存的内容文件
  4. 前端之前端介绍或html的常用标签1
  5. 2019.01.19 codeforces915E.Physical Education Lessons(ODT)
  6. 多项式相关&&生成函数相关&&一些题目(updating...)
  7. mysql学习之路_事物_存储过程_备份
  8. base_expr +: width_expr
  9. oss 上传文件夹-cloud2-泽优软件
  10. Job Interview: Why Only 3 Questions Really Matter