# 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 thisif you need tohandle more clients
#maxClientCnxns=60
#
# Be sure toread 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 toretain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Setto"0"todisable auto purge feature
#autopurge.purgeInterval=1
## MetricsProviders
#
# https://prometheus.io MetricsExporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
启动服务器(单机版)
在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= 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闪退 解决方案