一.解压配置
1.在/usr/local/新建zookeeper
mkdir /usr/local/zookeeper
cd /usr/local/zookeeper
2.将zk压缩包上传至这里
解压
tar zxvf apache-zookeeper-3.5.9-bin.tar.gz
3.进入解压文件夹apache-zookeeper-3.5.9-bin的conf目录修改配置文件
从zoo_sample.cfg复制一份重命名zoo.cfg即可;
[root@vm0 conf]# ls -a
. .. configuration.xsl log4j.properties zoo.cfg zoo_sample.cfg
#文件内容为:
# The number of milliseconds of each tick
tickTime=2000
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
syncLimit=5
# example sakes.
dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
image.png
二.运行zk
在bin目录下
[root@vm bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/apache-zookeeper-3.5.9-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
1. 启动ZK服务:
./zkServer.sh start
2. 查看ZK服务状态:
./zkServer.sh status
3. 停止ZK服务:
./zkServer.sh stop
4. 重启ZK服务:
./zkServer.sh restart
网友评论