Linux 安装Zookeeper

1. 创建zookeeper文件夹

mkdir -p /usr/local/zookeeper

2. 下载zookeeper安装包到/usr/local/zookeeper 

      2.1) linux命令方式(zookeeper-3.4.14/zookeeper-3.4.14.tar.gz需要下载的包名)

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

     2.2) 本地下载再拖拽到服务器(下载地址:http://mirror.bit.edu.cn/apache/zookeeper/)

3. 解压zookeeper-3.4.14.tar.gz

tar -zxvf zookeeper-3.4.14.tar.gz 

4. 拷贝zoo_sample.cfg为zoo.cfg

cp /usr/local/zookeeper/zookeeper-3.4.14/conf/zoo_sample.cfg zoo.cfg

 效果:

Linux 安装Zookeeper_第1张图片

5. 编辑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=/usr/zookeeper  
dataLogDir=/usr/zookeeper/log  
# the port at which the clients will connect  
clientPort=2181  

6. 设置环境变量(两条命令)

export ZOOKEEPER_INSTALL=/usr/local/zookeeper/zookeeper-3.4.14
export PATH=$PATH:$ZOOKEEPER_INSTALL/bin

7. 启动与关闭zookeeper

/usr/local/zookeeper/zookeeper-3.4.14/bin/zkServer.sh start

启动效果: 

 

/usr/local/zookeeper/zookeeper-3.4.14/bin/zkServer.sh stop

 关闭效果:

8. 测试

/usr/local/zookeeper/zookeeper-3.4.14/bin/zkCli.sh -server

 效果:

Linux 安装Zookeeper_第2张图片

 

命令请参考: https://blog.csdn.net/qq_38270106/article/details/83049115 

你可能感兴趣的:(linux,zookeeper)