第一步:下载安装包 这里以3.4.11为例
点进去看:
下载tar文件
第二步:上传到服务器
使用ftp工具上传文件到服务器:
第三步:解压文件
解压命令:tar -zxvf zookeeper-3.4.11.tar.gz
重命名为:zookeeper
mv zookeeper-3.4.11 zookeeper
拷贝到如下所示目录:
cp zookeeper /usr/local/zookeeper -rf
进入:zk目录
cd /usr/local/zookeeper/
进入conf目录,并且复制一份配置文件并且重命名:
打开这个文件
vim zoo.cfg
配置数据文件路径,以及日志文件路径,注意不要使用原有自带的:
dataDir=/usr/local/zookeeper/dataDir
dataLogDir=/usr/local/zookeeper/dataLogDir
保存::wq!
进入zk的bin目录,然后启动zk服务:./zkServer.sh start
OK,这个时候启动成功,在观看一下zk的状态:./zkServer.sh status
配置zk环境变量:
export ZOOKEEPER_HOME=/usr/local/zookeeper
export PATH=$PATH:$ZOOKEEPER_HOME/bin:$JAVA_HOME/bin