• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

安装Zookeeper3.4.10

武飞扬头像
lambda-小张
帮助1

目录

安装Zookeeper

1.安装

1.上传安装包

2.配置文件

1.修改zoo_sample.cfg名称

2.创建一个存放zk数据的目录:

3.配置zoo.cfg 

4.测试

3.把集群文件同步到其它机器

1.同步文件

2.写入

4.集群的启动与关闭

5.检查集群启动的状态


安装Zookeeper

1.安装

1.上传安装包

zookeeper-3.4.10.tar.gz

2.解压安装包

  1.  
    [root@hadoop01 software]# tar -zxvf zookeeper-3.4.10.tar.gz -C /opt/module/
  2.  
    [root@hadoop01 software]# cd /opt/module/
  3.  
    [root@hadoop01 module]# mv zookeeper-3.4.10/ zookeeper
  4.  
    [root@hadoop01 conf]# cd /opt/module/zookeeper/conf

2.配置文件

1.修改zoo_sample.cfg名称

[root@hadoop01 conf]# mv zoo_sample.cfg zoo.cfg

2.创建一个存放zk数据的目录:

[root@hadoop01 zookeeper]# mkdir /opt/module/zookeeper/data

3.配置zoo.cfg 

  1.  
    [root@hadoop01 zookeeper]# vim conf/zoo.cfg
  2.  
     
  3.  
    # The number of milliseconds of each tick
  4.  
    tickTime=2000
  5.  
    # The number of ticks that the initial
  6.  
    # synchronization phase can take
  7.  
    initLimit=10
  8.  
    # The number of ticks that can pass between
  9.  
    # sending a request and getting an acknowledgement
  10.  
    syncLimit=5
  11.  
    # the directory where the snapshot is stored.
  12.  
    # do not use /tmp for storage, /tmp here is just
  13.  
    # example sakes.
  14.  
    dataDir=/opt/module/zookeeper/data
  15.  
    # the port at which the clients will connect
  16.  
    clientPort=2181
  17.  
    # the maximum number of client connections.
  18.  
    # increase this if you need to handle more clients
  19.  
    #maxClientCnxns=60
  20.  
    #
  21.  
    # Be sure to read the maintenance section of the
  22.  
    # administrator guide before turning on autopurge.
  23.  
    #
  24.  
    # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
  25.  
    #
  26.  
    # The number of snapshots to retain in dataDir
  27.  
    #autopurge.snapRetainCount=3
  28.  
    # Purge task interval in hours
  29.  
    # Set to "0" to disable auto purge feature
  30.  
    #autopurge.purgeInterval=1
  31.  
    #配置集群的机器
  32.  
    server.1=hadoop01:2888:3888
  33.  
    server.2=hadoop02:2888:3888
  34.  
    server.3=hadoop03:2888:3888
学新通

4.测试

  1.  
    [root@hadoop01 data]# cd /opt/module/zookeeper/data/
  2.  
    [root@hadoop01 data]# touch myid
  3.  
    [root@hadoop01 data]# echo 1 > myid
  4.  
    [root@hadoop01 data]# cat myid
  5.  
    1

3.把集群文件同步到其它机器

1.同步文件

[root@hadoop01 zookeeper]# /root/bin/xsync /opt/module/zookeeper

2.写入

  1.  
    [root@hadoop01 zookeeper]# cd /opt/module/zookeeper/data/
  2.  
    [root@hadoop01 data]# cat myid
  3.  
    1
  4.  
    [root@hadoop02 data]# echo 2 > myid
  5.  
    [root@hadoop02 data]# cat myid
  6.  
    2
  7.  
    [root@hadoop03 module]# cd /opt/module/zookeeper/data/
  8.  
    [root@hadoop03 data]# echo 3 > myid
  9.  
    [root@hadoop03 data]# cat myid
  10.  
    3

4.集群的启动与关闭

  1.  
    [root@hadoop01 data]# cd /opt/module/zookeeper/
  2.  
    [root@hadoop02 data]# cd /opt/module/zookeeper/
  3.  
    [root@hadoop03 data]# cd /opt/module/zookeeper/
  4.  
    在三台机器中执行命令:
  5.  
    # bin/zkServer.sh start ---启动命令
  6.  
    # bin/zkServer.sh stop ---停止命令
  7.  
    # bin/zkServer.sh status ---查看状态命令

5.检查集群启动的状态

  1.  
    [root@hadoop01 zookeeper]# bin/zkServer.sh status
  2.  
    ZooKeeper JMX enabled by default
  3.  
    Using config: /opt/module/zookeeper/bin/../conf/zoo.cfg
  4.  
    Mode: follower
  5.  
     
  6.  
    [root@hadoop02 zookeeper]# bin/zkServer.sh status
  7.  
    ZooKeeper JMX enabled by default
  8.  
    Using config: /opt/module/zookeeper/bin/../conf/zoo.cfg
  9.  
    Mode: leader
  10.  
     
  11.  
    [root@hadoop03 zookeeper]# bin/zkServer.sh status
  12.  
    ZooKeeper JMX enabled by default
  13.  
    Using config: /opt/module/zookeeper/bin/../conf/zoo.cfg
  14.  
    Mode: follower

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgabcak
系列文章
更多 icon
同类精品
更多 icon
继续加载