侧边栏壁纸
  • 累计撰写 43 篇文章
  • 累计创建 9 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

ZooKeeper单体安装和测试

landonchan
2022-01-10 / 0 评论 / 0 点赞 / 6 阅读 / 2880 字
温馨提示:
欢迎留言讨论!若内容或图片失效,请留言反馈。若不小心影响到您的利益,请联系我们删除。

Download 下载

https://zookeeper.apache.org/releases.html

选择最新稳定版下载,下载后解压

示例配置文件

执行 cd命令到根目录下,cd 到 conf 目录下,可以看到一个zoo_sample.cfg示例配置文件。

cat zoo_sample.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.
#
# https://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

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpHost=0.0.0.0
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
  • tickTime :ZooKeeper 使用的基本时间单位(以毫秒为单位)。它用于进行心跳,最小会话超时将是tickTime 的两倍。

  • dataDir :存储内存数据库快照的位置,除非另有指定,否则存储数据库更新的事务日志。

  • clientPort : 监听客户端连接的端口

创建自己的配置文件

vim zoo.cfg

填写文件内容

tickTime=2000
dataDir=~/zookeeper/data
clientPort=2181

启动 zookeeper

bin/zkServer.sh start

zkCli连接

 bin/zkCli.sh -server 127.0.0.1:2181

zkcli测试

0

评论区