1.查看zk端口号是否被占用
a.netstat -lntup 2181;
b.lsof -i:2181;
c.ps aux | grep 2181;
2.解压安装包
tar -zxvf /home/soft/zookeeper-3.4.9.tar.gz -C /usr/local/tools/zookeeper
3.复制conf文件夹下的zoo_sample.cfg
a.cp zoo_sample.cfg zoo.cfg
b.修改文件zoo.cfg:
dataDir=/usr/local/tools/zookeeper/zookeeper-3.4.9/data
dataLogDir=/usr/local/tools/zookeeper/zookeeper-3.4.9/logs
4.修改配置文件:vi /etc/profile
export ZOOKEEPER_HOME=/usr/local/tools/zookeeper/zookeeper-3.4.9
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
5.生效配置文件
source /etc/profile
6.启动zk:./bin/zkServer.sh start;
重启zk:./bin/zkServer.sh restart;
查看zk状态:./bin/zkServer.sh status
停止服务:./bin/zkServer.sh stop
ps -ef | grep zookeeper;
kill -9 pid;
检查是否启动成功:./bin/zkCli.sh -server localhost:2181
查看日志:tail -100f .//zookeeper.out
7.输入jps命令查看进程
1580 QuorumPeerMain
1601 Jps
1347 Bootstrap
其中QuorumPeerMain是zookeeper的进程,已启动