参考链接:
https://blog.csdn.net/baidu_37313657/article/details/105368119
https://www.cnblogs.com/zwcry/p/10244908.html
两种安装包如何选择:
https://blog.csdn.net/u010411264/article/details/104706506?
一、运行环境和安装包
注:此次为zookeeper单机版
1、系统:Centos7 64位
虚拟机192.168.224.130
2、前提约束:
jdk1.8已经安装完毕
3、软件包:
apache-zookeeper-3.6.0-bin.tar.gz
二、解压安装zookeeper
1、解压
tar -zxvf apache-zookeeper-3.6.0-bin.tar.gz
2、重命名
mv apache-zookeeper-3.6.0-bin zookeeper
mv zookeeper /usr/local/
cd /usr/local/
ls
三、修改环境变量使其生效
1、修改配置文件
vim /etc/profile
添加内容
export ZOOKEEPER_HOME=/usr/local/zookeeper
export PATH=$PATH:$ZOOKEEPER_HOME/bin
2、立即生效
source /etc/profile
四、修改zookeeper配置文件信息
1、进入zookeeper目录,把zoo_sample.cfg复制份zoo.cfg
cd /usr/local/zookeeper/conf
cp zoo_sample.cfg zoo.cfg
2、在/usr/local/zookeeper创建两个文件夹,dataDir文件夹和dataLogDir日志目录,如果不配置会和dataDir共用
cd /usr/local/zookeeper
mkdir dataDir
mkdir dataLogDir
3、进入配置文件,修改配置文件将原来的dataDir改为新的路径地址
cd /usr/local/zookeeper/conf
vim zoo.cfg
修改内容
dataDir=/usr/local/zookeeper/dataDir
dataLogDir=/usr/local/zookeeper/dataLogDir
五、启动zookeeper服务
1、启动zookeeper服务
cd /usr/local/zookeeper/bin
./zkServer.sh start
2、关闭zookeeper服务
cd /usr/local/zookeeper/bin
./zkServer.sh stop
六、zookeeper客户端连接服务
1、zookeeper客户端连接服务
cd /usr/local/zookeeper/bin
./zkCli.sh
2、关闭zookeeper客户端连接服务
quit
七、安装测试
1、测试命令
ls /
create /cs-node cs-val
get /cs-node
set /cs-node nicai
get /cs-node
delete /cs-node
get /cs-node
close
quit