当前位置: 首页 > news >正文

Zookeeper安装及使用

文章目录

    • Windows下安装
    • 下载并安装
    • 修改配置
    • 启动服务器(单机版)
    • 启动异常

Windows下安装

下载并安装

  • 在zookeeper官网找到最新的稳定版本tar.gz
    在这里插入图片描述
  • 解压到本地,并在根目录创建一个data文件夹
    在这里插入图片描述

修改配置

  • 进入conf目录中,将zoo_sample.cfg修改为zoo.cfgzoo.cfg是zookeeper的配置文件。
  • 修改配置,将用于存储内存数据库快照文件dataDir指定到刚才创建的data目录,注意windows下的路径分隔符为/,修改后的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=F:/DevResource/apache-zookeeper-3.7.1-bin/data
    # 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
    
    ## Metrics Providers
    #
    # https://prometheus.io Metrics Exporter
    #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
    #metricsProvider.httpPort=7000
    #metricsProvider.exportJvmInfo=true
    

    启动服务器(单机版)

    • bin目录下执行zkServer.cmd
      在这里插入图片描述
      启动成功!

启动异常

问题1:端口占用
2022-08-30 17:29:44,107 [myid:] - INFO [main:Environment@98] - Server environment:java.io.tmpdir=C:\Users\hucong\AppData\Local\Temp\ 2022-08-30 17:29:44,107 [myid:] - INFO [main:Environment@98] - Server environment:java.compiler=<NA> 2022-08-30 17:29:44,108 [myid:] - INFO [main:Environment@98] - Server environment:os.name=Windows 10 2022-08-30 17:29:44,108 [myid:] - INFO [main:Environment@98] - Server environment:os.arch=amd64 2022-08-30 17:29:44,109 [myid:] - INFO [main:Environment@98] - Server environment:os.version=10.0 2022-08-30 17:29:44,109 [myid:] - INFO [main:Environment@98] - Server environment:user.name=hucong 2022-08-30 17:29:44,109 [myid:] - INFO [main:Environment@98] - Server environment:user.home=C:\Users\hucong 2022-08-30 17:29:44,110 [myid:] - INFO [main:Environment@98] - Server environment:user.dir=F:\DevResource\apache-zookeeper-3.7.1-bin\bin 2022-08-30 17:29:44,110 [myid:] - INFO [main:Environment@98] - Server environment:os.memory.free=196MB 2022-08-30 17:29:44,110 [myid:] - INFO [main:Environment@98] - Server environment:os.memory.max=3156MB 2022-08-30 17:29:44,111 [myid:] - INFO [main:Environment@98] - Server environment:os.memory.total=213MB 2022-08-30 17:29:44,111 [myid:] - INFO [main:ZooKeeperServer@138] - zookeeper.enableEagerACLCheck = false 2022-08-30 17:29:44,112 [myid:] - INFO [main:ZooKeeperServer@151] - zookeeper.digest.enabled = true 2022-08-30 17:29:44,112 [myid:] - INFO [main:ZooKeeperServer@155] - zookeeper.closeSessionTxn.enabled = true 2022-08-30 17:29:44,113 [myid:] - INFO [main:ZooKeeperServer@1505] - zookeeper.flushDelay=0 2022-08-30 17:29:44,113 [myid:] - INFO [main:ZooKeeperServer@1514] - zookeeper.maxWriteQueuePollTime=0 2022-08-30 17:29:44,113 [myid:] - INFO [main:ZooKeeperServer@1523] - zookeeper.maxBatchSize=1000 2022-08-30 17:29:44,114 [myid:] - INFO [main:ZooKeeperServer@260] - zookeeper.intBufferStartingSizeBytes = 1024 2022-08-30 17:29:44,115 [myid:] - INFO [main:BlueThrottle@141] - Weighed connection throttling is disabled 2022-08-30 17:29:44,116 [myid:] - INFO [main:ZooKeeperServer@1306] - minSessionTimeout set to 4000 2022-08-30 17:29:44,121 [myid:] - INFO [main:ZooKeeperServer@1315] - maxSessionTimeout set to 40000 2022-08-30 17:29:44,122 [myid:] - INFO [main:ResponseCache@45] - getData response cache size is initialized with value 400. 2022-08-30 17:29:44,122 [myid:] - INFO [main:ResponseCache@45] - getChildren response cache size is initialized with value 400. 2022-08-30 17:29:44,123 [myid:] - INFO [main:RequestPathMetricsCollector@109] - zookeeper.pathStats.slotCapacity = 60 2022-08-30 17:29:44,123 [myid:] - INFO [main:RequestPathMetricsCollector@110] - zookeeper.pathStats.slotDuration = 15 2022-08-30 17:29:44,124 [myid:] - INFO [main:RequestPathMetricsCollector@111] - zookeeper.pathStats.maxDepth = 6 2022-08-30 17:29:44,124 [myid:] - INFO [main:RequestPathMetricsCollector@112] - zookeeper.pathStats.initialDelay = 5 2022-08-30 17:29:44,125 [myid:] - INFO [main:RequestPathMetricsCollector@113] - zookeeper.pathStats.delay = 5 2022-08-30 17:29:44,125 [myid:] - INFO [main:RequestPathMetricsCollector@114] - zookeeper.pathStats.enabled = false 2022-08-30 17:29:44,128 [myid:] - INFO [main:ZooKeeperServer@1542] - The max bytes for all large requests are set to 104857600 2022-08-30 17:29:44,129 [myid:] - INFO [main:ZooKeeperServer@1556] - The large request threshold is set to -1 2022-08-30 17:29:44,129 [myid:] - INFO [main:AuthenticationHelper@66] - zookeeper.enforce.auth.enabled = false 2022-08-30 17:29:44,130 [myid:] - INFO [main:AuthenticationHelper@67] - zookeeper.enforce.auth.schemes = [] 2022-08-30 17:29:44,130 [myid:] - INFO [main:ZooKeeperServer@361] - Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 clientPortListenBacklog -1 datadir F:\DevResource\apache-zookeeper-3.7.1-bin\data\version-2 snapdir F:\DevResource\apache-zookeeper-3.7.1-bin\data\version-2 2022-08-30 17:29:44,162 [myid:] - INFO [main:Log@170] - Logging initialized @321ms to org.eclipse.jetty.util.log.Slf4jLog 2022-08-30 17:29:44,219 [myid:] - WARN [main:ContextHandler@1656] - o.e.j.s.ServletContextHandler@56ac3a89{/,null,STOPPED} contextPath ends with /* 2022-08-30 17:29:44,219 [myid:] - WARN [main:ContextHandler@1667] - Empty contextPath 2022-08-30 17:29:44,233 [myid:] - INFO [main:Server@375] - jetty-9.4.43.v20210629; built: 2021-06-30T11:07:22.254Z; git: 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8; jvm 1.8.0_181-b13 2022-08-30 17:29:44,256 [myid:] - INFO [main:DefaultSessionIdManager@334] - DefaultSessionIdManager workerName=node0 2022-08-30 17:29:44,257 [myid:] - INFO [main:DefaultSessionIdManager@339] - No SessionScavenger set, using defaults 2022-08-30 17:29:44,258 [myid:] - INFO [main:HouseKeeper@132] - node0 Scavenging every 660000ms 2022-08-30 17:29:44,261 [myid:] - WARN [main:ConstraintSecurityHandler@759] - ServletContext@o.e.j.s.ServletContextHandler@56ac3a89{/,null,STARTING} has uncovered http methods for path: /* 2022-08-30 17:29:44,269 [myid:] - INFO [main:ContextHandler@915] - Started o.e.j.s.ServletContextHandler@56ac3a89{/,null,AVAILABLE} 2022-08-30 17:29:44,274 [myid:] - ERROR [main:ZooKeeperServerMain@86] - Unable to start AdminServer, exiting abnormally org.apache.zookeeper.server.admin.AdminServer$AdminServerException: Problem starting AdminServer on address 0.0.0.0, port 8080 and command URL /commands at org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:188) at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:155) at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:113) at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:68) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:141) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:91) Caused by: java.io.IOException: Failed to bind to /0.0.0.0:8080 at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349) at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310) at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80) at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) at org.eclipse.jetty.server.Server.doStart(Server.java:401) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) at org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:179) ... 5 more Caused by: java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:433) at sun.nio.ch.Net.bind(Net.java:425) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ... 12 more Unable to start AdminServer, exiting abnormally 2022-08-30 17:29:44,282 [myid:] - INFO [main:ZKAuditProvider@42] - ZooKeeper audit is disabled. 2022-08-30 17:29:44,283 [myid:] - ERROR [main:ServiceUtils@48] - Exiting JVM with code 4
参考:Windows下启动Zookeeper闪退 解决方案

相关文章:

  • java基于springboot+vue的碳排放管理平台系统
  • 超详细的springBoot学习笔记
  • k8s 安装 ingress-nginx
  • 【卫朋】产品管理:如何管理项目进度?
  • 超强、超详细Redis入门教程
  • 你还不会写API文档吗
  • Mach-O详解(一) - 破题
  • 今天来说说Java开发中常用的框架有哪些?
  • Three.js对模型进行多区域染色
  • 超全面试汇总——Hadoop(二)
  • Android辅助功能(Accessibility)简介
  • SSM网约车管理系统毕业设计-附源码051630
  • (9)YOLO-Pose:使用对象关键点相似性损失增强多人姿态估计的增强版YOLO
  • 第11章Linux实操篇-Linux磁盘分区、挂载
  • Kotlin协程:Flow的融合、Channel容量、溢出策略
  • [nginx文档翻译系列] 控制nginx
  • C++类的相互关联
  • Go 语言编译器的 //go: 详解
  • Golang-长连接-状态推送
  • hadoop集群管理系统搭建规划说明
  • iOS小技巧之UIImagePickerController实现头像选择
  • JS函数式编程 数组部分风格 ES6版
  • k8s如何管理Pod
  • magento 货币换算
  • Octave 入门
  • python 学习笔记 - Queue Pipes,进程间通讯
  • 第十八天-企业应用架构模式-基本模式
  • 高程读书笔记 第六章 面向对象程序设计
  • 近期前端发展计划
  • 排序算法之--选择排序
  • 前端路由实现-history
  • 融云开发漫谈:你是否了解Go语言并发编程的第一要义?
  • 深度学习入门:10门免费线上课程推荐
  • 使用putty远程连接linux
  • 用jQuery怎么做到前后端分离
  • 用Node EJS写一个爬虫脚本每天定时给心爱的她发一封暖心邮件
  • 2017年360最后一道编程题
  • # 透过事物看本质的能力怎么培养?
  • #图像处理
  • (floyd+补集) poj 3275
  • (windows2012共享文件夹和防火墙设置
  • (办公)springboot配置aop处理请求.
  • (三)mysql_MYSQL(三)
  • (转)四层和七层负载均衡的区别
  • .dat文件写入byte类型数组_用Python从Abaqus导出txt、dat数据
  • .libPaths()设置包加载目录
  • .NET : 在VS2008中计算代码度量值
  • .NET CORE 2.0发布后没有 VIEWS视图页面文件
  • .net core 3.0 linux,.NET Core 3.0 的新增功能
  • .NET Core MongoDB数据仓储和工作单元模式封装
  • .net core webapi Startup 注入ConfigurePrimaryHttpMessageHandler
  • .NET Framework 3.5中序列化成JSON数据及JSON数据的反序列化,以及jQuery的调用JSON
  • .Net Memory Profiler的使用举例
  • .net 无限分类
  • .NET开源项目介绍及资源推荐:数据持久层 (微软MVP写作)