ZooKeeper 安装与部署
一、下载
下载地址:http://mirror.bit.edu.cn/apache/zookeeper/stable/apache-zookeeper-3.5.5-bin.tar.gz
二、安装
直接解压到期望文件夹。
三、配置
在解压后的文件夹中添加两个目录,data和logs,用于存储数据与日志。
文件夹conf中,存放配置文件,现有一个名为zoo_sample.cfg的文件,这是示例配置文件。
新建配置文件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.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=E:\\environment\\zookeeper\\apache-zookeeper-3.5.5\\data
dataLogDir=E:\\environment\\zookeeper\\apache-zookeeper-3.5.5\\logs
# the port at which the clients will connect
clientPort=2181
四、启动
打开命令提示符,进入bin目录,输入zkServer启动。
E:\environment\zookeeper\apache-zookeeper-3.5.5\bin>zkServer E:\environment\zookeeper\apache-zookeeper-3.5.5\bin>call "C:\Program Files\Java\jdk1.8.0_181"\bin\java "-Dzookeeper.log.dir=E:\environment\zookeeper\apache-zookeeper-3.5.5\bin\..\logs" "-Dzookeeper.root.logger=INFO,CONSOLE" "-Dzookeeper.log.file=zookeeper-Kuningasic-server-DESKTOP-KJCEOIF.log" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%p /t /f" -cp "E:\environment\zookeeper\apache-zookeeper-3.5.5\bin\..\build\classes;E:\environment\zookeeper\apache-zookeeper-3.5.5\bin\..\build\lib\*;E:\environment\zookeeper\apache-zookeeper-3.5.5\bin\..\*;E:\environment\zookeeper\apache-zookeeper-3.5.5\bin\..\lib\*;E:\environment\zookeeper\apache-zookeeper-3.5.5\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "E:\environment\zookeeper\apache-zookeeper-3.5.5\bin\..\conf\zoo.cfg" 2019-06-12 20:56:27,191 [myid:] - INFO [main:QuorumPeerConfig@133] - Reading configuration from: E:\environment\zookeeper\apache-zookeeper-3.5.5\bin\..\conf\zoo.cfg 2019-06-12 20:56:27,201 [myid:] - INFO [main:QuorumPeerConfig@385] - clientPortAddress is 0.0.0.0/0.0.0.0:2181 2019-06-12 20:56:27,201 [myid:] - INFO [main:QuorumPeerConfig@389] - secureClientPort is not set 2019-06-12 20:56:27,204 [myid:] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3 2019-06-12 20:56:27,206 [myid:] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0 2019-06-12 20:56:27,206 [myid:] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled. 2019-06-12 20:56:27,206 [myid:] - WARN [main:QuorumPeerMain@125] - Either no config or no quorum defined in config, running in standalone mode 2019-06-12 20:56:27,208 [myid:] - INFO [main:ManagedUtil@46] - Log4j found with jmx enabled. 2019-06-12 20:56:27,286 [myid:] - INFO [main:QuorumPeerConfig@133] - Reading configuration from: E:\environment\zookeeper\apache-zookeeper-3.5.5\bin\..\conf\zoo.cfg 2019-06-12 20:56:27,286 [myid:] - INFO [main:QuorumPeerConfig@385] - clientPortAddress is 0.0.0.0/0.0.0.0:2181 2019-06-12 20:56:27,287 [myid:] - INFO [main:QuorumPeerConfig@389] - secureClientPort is not set 2019-06-12 20:56:27,287 [myid:] - INFO [main:ZooKeeperServerMain@117] - Starting server