linux下安装zookeeper

1、下载zookeeper的安装包
  wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz

2、解压压缩包
  tar zxvf zookeeper-3.3.6.tar.gz

3、在zookeeper的跟目录下创建两个文件夹data和datalog

  这两个路径主要是用来存放zk的数据以及日志的(待会需要手动在配置文件中设置)

  在data目录下创建一个myid的文件,里面的值可以给个任意的值,主要用于集群中区分某个势力
   

4、将入zookeeper的conf目录下,复制zoo_sample.cfg文件并自定义配置

  cp zoo_sample.cfg zoo.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.
dataDir=/www/websoft/zookeeper-3.3.6/data
dataLogDir=/www/websoft/zookeeper-3.3.6/datalog
# the port at which the clients will connect
clientPort=2181
server.100=192.168.1.21:2888:3888

这里只是配置了一个单机的zookeeper,需要配置成集群的话只要在最后面加上其他服务器的ip和端口就行了(类似server.100=192.168.1.21:2888:3888

5、启动zookeeper

  cd /www/websoft/zookeeper-3.3.6

  bin/zkServer.sh start &

 zk启动后查看zk的启动情况
bin/zkServer.sh status

当出现这种信息就说明你的zk已经安装成功了

原文地址:https://www.cnblogs.com/gulang-jx/p/7423564.html