当前位置:   article > 正文

【linux 安装zookeeper 】_linux 3.8zk安装

linux 3.8zk安装

1、下载zookeeper安装

https://downloads.apache.org/zookeeper/
这里下载的是:apache-zookeeper-3.8.0-bin.tar.gz 版本

2、上传zookeeper 的安装包到Linux 服务器上面

在home目录下新建/zookeeper目录

cd /home/
mkdir zookeeper
  • 1
  • 2

将下载的压缩包上传到/home/zookeeper目录下

3、解压

tar -zxvf apache-zookeeper-3.8.0-bin.tar.gz
  • 1

在 /zookeeper目录下创建一个文件夹 zookeeperData 用来存放zookeeper 的数据文件

cd /home/zookeeper/
mkdir zookeeperData
  • 1
  • 2

修改配置文件

复制cp zoo_sample.cfg zoo.cfg

#进入 /home/zookeeper/apache-zookeeper-3.8.0-bin/conf 目录
 cd /home/zookeeper/apache-zookeeper-3.8.0-bin/conf
 # 复制 zoo_sample.cfg 文件,并重命名为zoo.cfg 否则zookeeper不会生效
 cp zoo_sample.cfg zoo.cfg
  • 1
  • 2
  • 3
  • 4

编辑 zoo.cfg 文件,

修改 dataDir 属性等于 /tmp/zookeeper 如下第13行所示

 # 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.
 # 主要是这里<需要修改成zookeeper的数据文件目录>
 dataDir=/home/zookeeper/zookeeperData
 # 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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

修改后保存退出

启动/关闭/查看状态 zookeeper 服务

1.进入zookeeper安装目录的bin 目录

 cd /home/zookeeper/apache-zookeeper-3.8.0-bin/bin
  • 1

2. 启动zookeeper

 ./zkServer.sh start
  • 1

3. 关闭zookeeper

 ./zkServer.sh stop
  • 1

4. 查看zookeeper的状态

 ./zkServer.sh status
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/629670
推荐阅读
相关标签
  

闽ICP备14008679号