安装zookeeper作为dubbo的注册中心
官网链接 https://www.apache.org/dyn/closer.cgi/zookeeper/
清华镜像的下载页面连接
https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/
一、3.4的版本
连接https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/
1.下载
2.解压 tar -zxvf win10的也可以这么用
3.配置文件
复制 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=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
#数据和日志
dataDir=../data
dataLogDir=../log
4.启动 进入bin目录,运行zkServer.cmd
至此windows版本的本地zookeeper就可以运行的
二、5.6版本的
先分享我的一次操作经历
首先下载apache-zookeeper-3.5.6.tar.gz 解压
然后发现里面和3.4的目录结构不一样
才发现这是源码,于是
mvn clean
mvn install -Dmaven.test.skip=true
然后进去bin目录运行zkServer.cmd发现少了一些jar包,就是3.4版本的lib目录下面的日志jar包的等,坑的一笔啊!
操作
1.下载 选择带有bin的 apache-zookeeper-3.5.6-bin.tar.gz
2.解压 tar -zxvf win10的也可以这么用
3.配置文件同上
在上面的配置基础之上还要注意一点
这个版本的zookeeper默认端口为8080,这就坑了,和tomcat冲突
在上面基础上加上一句,修改端口
admin.serverPort=8888
4.启动 进入bin目录,运行zkServer.cmd
安装完毕,等到整合dubbo的时候又是坑
本文为作者原创,转载请注明出处!