[root@VM-0-16-centos /]# docker run -d –name zookeeper -p 2181:2181 -v /etc/localtime:/etc/localtime wurstmeister/zookeepe
Unable to find image ‘wurstmeister/zookeepe:latest’ locally
Trying to pull repository docker.io/wurstmeister/zookeepe …
/usr/bin/docker-current: repository docker.io/wurstmeister/zookeepe not found: does not exist or no pull access.
See ‘/usr/bin/docker-current run –help’.
docker run -d –name zookeeper -p 2181:2181 -v /etc/localtime:/etc/localtime zookeeper
mkdir /home/zk cd /home/zk touch zk.yml
[root@ls zk]# cat zk.yml
version: ‘3.1’
services:
zk2:
image: ‘zookeeper:3.7’
restart: always
hostname: zoo2
container_name: zk2
network_mode: host
ports:
– 2181:2181
– 2888:2888
– 3888:3888
environment:
ZOO_MY_ID: 2
ZOO_SERVERS: server.1=119.29.17.67:2888:3888;2181 server.2=182.61.40.160:2888:3888;2181
docker-compose -f zk.yml up -d
docker exec -it zk1 bash
Error response from daemon: Container f9093ad7e4e32c7e57ce01096f9c285ce973e7df498a05137b54e156afc3ba05 is restarting, wait until the container is running
2023-09-25 07:26:11,040 [myid:1] – ERROR [ListenerHandler-/119.29.17.67:3888:QuorumCnxManager$Listener$ListenerHandler@1118] – Leaving listener thread for address 119.29.17.67:3888 after 3 errors. Use zookeeper.electionPortBindRetry property to increase retry count.
2023-09-25 07:26:11,042 [myid:1] – INFO [QuorumPeerListener:QuorumCnxManager$Listener@985] – Leaving listener
2023-09-25 07:26:11,042 [myid:1] – ERROR [QuorumPeerListener:QuorumCnxManager$Listener@987] – As I’m leaving the listener thread, I won’t be able to participate in leader election any longer: 119.29.17.67:3888
2023-09-25 07:26:11,044 [myid:1] – ERROR [QuorumPeerListener:ServiceUtils@48] – Exiting JVM with code 14
ZooKeeper JMX enabled by default
Using config: /conf/zoo.cfg
2023-09-25 07:27:03,613 [myid:] – INFO [main:QuorumPeerConfig@174] – Reading configuration from: /conf/zoo.cfg
2023-09-25 07:27:03,617 [myid:] – INFO [main:QuorumPeerConfig@435] – clientPort is not set
2023-09-25 07:27:03,618 [myid:] – INFO [main:QuorumPeerConfig@448] – secureClientPort is not set
2023-09-25 07:27:03,618 [myid:] – INFO [main:QuorumPeerConfig@464] – observerMasterPort is not set
2023-09-25 07:27:03,621 [myid:] – INFO [main:QuorumPeerConfig@481] – metricsProvider.className is org.apache.zookeeper.metrics.impl.DefaultMetricsProvider
2023-09-25 07:27:03,632 [myid:] – WARN [main:QuorumPeerConfig@713] – No server failure will be tolerated. You need at least 3 servers.
2023-09-25 07:27:03,640 [myid:1] – INFO [main:DatadirCleanupManager@78] – autopurge.snapRetainCount set to 3
2023-09-25 07:27:03,640 [myid:1] – INFO [main:DatadirCleanupManager@79] – autopurge.purgeInterval set to 0
2023-09-25 07:27:03,640 [myid:1] – INFO [main:DatadirCleanupManager@101] – Purge task is not scheduled.
2023-09-25 07:27:03,641 [myid:1] – INFO [main:ManagedUtil@46] – Log4j 1.2 jmx support not found; jmx disabled.
2023-09-25 07:27:03,641 [myid:1] – INFO [main:QuorumPeerMain@152] – Starting quorum peer, myid=1
2023-09-25 07:27:03,661 [myid:1] – INFO [main:ServerMetrics@62] – ServerMetrics initialized with provider org.apache.zookeeper.metrics.impl.DefaultMetricsProvider@6107227e
2023-09-25 07:27:03,675 [myid:1] – INFO [main:DigestAuthenticationProvider@47] – ACL digest algorithm is: SHA1
2023-09-25 07:27:03,675 [myid:1] – INFO [main:DigestAuthenticationProvider@61] – zookeeper.DigestAuthenticationProvider.enabled = true
2023-09-25 07:27:03,689 [myid:1] – INFO [main:ServerCnxnFactory@169] – Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory
2023-09-25 07:27:03,695 [myid:1] – WARN [main:ServerCnxnFactory@309] – maxCnxns is not configured, using default value 0.
2023-09-25 07:27:03,702 [myid:1] – INFO [main:NIOServerCnxnFactory@652] – Configuring NIO connection handler with 10s sessionless connection timeout, 1 selector thread(s), 2 worker threads, and 64 kB direct buffers.
2023-09-25 07:27:03,714 [myid:1] – INFO [main:NIOServerCnxnFactory@660] – binding to port /0.0.0.0:2181
2023-09-25 07:27:03,725 [myid:1] – INFO [main:QuorumPeer@797] – zookeeper.quorumCnxnTimeoutMs=-1
2023-09-25 07:27:03,768 [myid:1] – INFO [main:Log@170] – Logging initialized @959ms to org.eclipse.jetty.util.log.Slf4jLog
2023-09-25 07:27:03,911 [myid:1] – WARN [main:ContextHandler@1656] – o.e.j.s.ServletContextHandler@6200f9cb{/,null,STOPPED} contextPath ends with /*
2023-09-25 07:27:03,912 [myid:1] – WARN [main:ContextHandler@1667] – Empty contextPath
2023-09-25 07:27:03,950 [myid:1] – INFO [main:X509Util@77] – Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2023-09-25 07:27:03,961 [myid:1] – INFO [main:FileTxnSnapLog@124] – zookeeper.snapshot.trust.empty : false
2023-09-25 07:27:03,966 [myid:1] – INFO [main:QuorumPeer@1747] – Local sessions disabled
2023-09-25 07:27:03,966 [myid:1] – INFO [main:QuorumPeer@1758] – Local session upgrading disabled
2023-09-25 07:27:03,970 [myid:1] – INFO [main:QuorumPeer@1725] – tickTime set to 2000
2023-09-25 07:27:03,970 [myid:1] – INFO [main:QuorumPeer@1769] – minSessionTimeout set to 4000
2023-09-25 07:27:03,970 [myid:1] – INFO [main:QuorumPeer@1780] – maxSessionTimeout set to 40000
2023-09-25 07:27:03,970 [myid:1] – INFO [main:QuorumPeer@1805] – initLimit set to 5
2023-09-25 07:27:03,970 [myid:1] – INFO [main:QuorumPeer@1992] – syncLimit set to 2
2023-09-25 07:27:03,970 [myid:1] – INFO [main:QuorumPeer@2007] – connectToLearnerMasterLimit set to 0
2023-09-25 07:27:03,984 [myid:1] – INFO [main:ZookeeperBanner@42] –
2023-09-25 07:27:03,985 [myid:1] – INFO [main:ZookeeperBanner@42] – _ _ 2023-09-25 07:27:03,985 [myid:1] – INFO [main:ZookeeperBanner@42] – | / | |
2023-09-25 07:27:03,985 [myid:1] – INFO [main:ZookeeperBanner@42] – / / | | _ _ _
2023-09-25 07:27:03,985 [myid:1] – INFO [main:ZookeeperBanner@42] – / / / _ \ / _ \ | |/ / / _ \ / _ \ | ‘_ \ / _ \ | ‘| 2023-09-25 07:27:03,985 [myid:1] – INFO [main:ZookeeperBanner@42] – / / | () | | () | | < | / | / | |) | | / | | 2023-09-25 07:27:03,985 [myid:1] – INFO [main:ZookeeperBanner@42] – /__| ___/ ___/ ||_\ __| ___| | ./ _| || 2023-09-25 07:27:03,985 [myid:1] – INFO [main:ZookeeperBanner@42] – | | 2023-09-25 07:27:03,985 [myid:1] – INFO [main:ZookeeperBanner@42] – ||
2023-09-25 07:27:03,989 [myid:1] – INFO [main:ZookeeperBanner@42] –
2023-09-25 07:27:03,995 [myid:1] – INFO [main:Environment@98] – Server environment:zookeeper.version=3.7.1-a2fb57c55f8e59cdd76c34b357ad5181df1258d5, built on 2022-05-07 06:45 UTC
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:host.name=
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:java.version=11.0.16
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:java.vendor=Oracle Corporation
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:java.home=/usr/local/openjdk-11
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:java.class.path=/apache-zookeeper-3.7.1-bin/bin/../zookeeper-server/target/classes:/apache-zookeeper-3.7.1-bin/bin/../build/classes:/apache-zookeeper-3.7.1-bin/bin/../zookeeper-server/target/lib/.jar:/apache-zookeeper-3.7.1-bin/bin/../build/lib/.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/zookeeper-prometheus-metrics-3.7.1.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/zookeeper-jute-3.7.1.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/zookeeper-3.7.1.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/snappy-java-1.1.7.7.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/slf4j-reload4j-1.7.35.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/slf4j-api-1.7.35.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/simpleclient_servlet-0.9.0.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/simpleclient_hotspot-0.9.0.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/simpleclient_common-0.9.0.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/simpleclient-0.9.0.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/reload4j-1.2.19.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/netty-transport-native-unix-common-4.1.76.Final.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/netty-transport-native-epoll-4.1.76.Final.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/netty-transport-classes-epoll-4.1.76.Final.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/netty-transport-4.1.76.Final.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/netty-resolver-4.1.76.Final.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/netty-handler-4.1.76.Final.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/netty-common-4.1.76.Final.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/netty-codec-4.1.76.Final.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/netty-buffer-4.1.76.Final.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/metrics-core-4.1.12.1.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jline-2.14.6.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jetty-util-ajax-9.4.43.v20210629.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jetty-util-9.4.43.v20210629.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jetty-servlet-9.4.43.v20210629.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jetty-server-9.4.43.v20210629.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jetty-security-9.4.43.v20210629.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jetty-io-9.4.43.v20210629.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jetty-http-9.4.43.v20210629.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/javax.servlet-api-3.1.0.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jackson-databind-2.13.2.1.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jackson-core-2.13.2.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/jackson-annotations-2.13.2.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/commons-cli-1.4.jar:/apache-zookeeper-3.7.1-bin/bin/../lib/audience-annotations-0.12.0.jar:/apache-zookeeper-3.7.1-bin/bin/../zookeeper-.jar:/apache-zookeeper-3.7.1-bin/bin/../zookeeper-server/src/main/resources/lib/.jar:/conf:
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:java.library.path=/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:java.io.tmpdir=/tmp
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:java.compiler=
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:os.name=Linux
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:os.arch=amd64
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:os.version=3.10.0-1160.88.1.el7.x86_64
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:user.name=zookeeper
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:user.home=/home/zookeeper
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:user.dir=/apache-zookeeper-3.7.1-bin
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:os.memory.free=21MB
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:os.memory.max=966MB
2023-09-25 07:27:03,996 [myid:1] – INFO [main:Environment@98] – Server environment:os.memory.total=30MB
2023-09-25 07:27:03,996 [myid:1] – INFO [main:ZooKeeperServer@138] – zookeeper.enableEagerACLCheck = false
2023-09-25 07:27:03,997 [myid:1] – INFO [main:ZooKeeperServer@151] – zookeeper.digest.enabled = true
2023-09-25 07:27:03,997 [myid:1] – INFO [main:ZooKeeperServer@155] – zookeeper.closeSessionTxn.enabled = true
2023-09-25 07:27:03,997 [myid:1] – INFO [main:ZooKeeperServer@1505] – zookeeper.flushDelay=0
2023-09-25 07:27:03,997 [myid:1] – INFO [main:ZooKeeperServer@1514] – zookeeper.maxWriteQueuePollTime=0
2023-09-25 07:27:03,997 [myid:1] – INFO [main:ZooKeeperServer@1523] – zookeeper.maxBatchSize=1000
2023-09-25 07:27:03,997 [myid:1] – INFO [main:ZooKeeperServer@260] – zookeeper.intBufferStartingSizeBytes = 1024
2023-09-25 07:27:04,014 [myid:1] – INFO [main:WatchManagerFactory@42] – Using org.apache.zookeeper.server.watch.WatchManager as watch manager
2023-09-25 07:27:04,014 [myid:1] – INFO [main:WatchManagerFactory@42] – Using org.apache.zookeeper.server.watch.WatchManager as watch manager
2023-09-25 07:27:04,019 [myid:1] – INFO [main:ZKDatabase@133] – zookeeper.snapshotSizeFactor = 0.33
2023-09-25 07:27:04,019 [myid:1] – INFO [main:ZKDatabase@153] – zookeeper.commitLogCount=500
2023-09-25 07:27:04,036 [myid:1] – INFO [main:QuorumPeer@2071] – Using insecure (non-TLS) quorum communication
2023-09-25 07:27:04,036 [myid:1] – INFO [main:QuorumPeer@2077] – Port unification disabled
2023-09-25 07:27:04,045 [myid:1] – INFO [main:QuorumPeer@180] – multiAddress.enabled set to false
2023-09-25 07:27:04,045 [myid:1] – INFO [main:QuorumPeer@205] – multiAddress.reachabilityCheckEnabled set to true
2023-09-25 07:27:04,045 [myid:1] – INFO [main:QuorumPeer@192] – multiAddress.reachabilityCheckTimeoutMs set to 1000
2023-09-25 07:27:04,045 [myid:1] – INFO [main:QuorumPeer@2532] – QuorumPeer communication is not secured! (SASL auth disabled)
2023-09-25 07:27:04,045 [myid:1] – INFO [main:QuorumPeer@2557] – quorum.cnxn.threads.size set to 20
2023-09-25 07:27:04,048 [myid:1] – INFO [main:SnapStream@61] – zookeeper.snapshot.compression.method = CHECKED
2023-09-25 07:27:04,055 [myid:1] – INFO [main:FileSnap@85] – Reading snapshot /data/version-2/snapshot.0
2023-09-25 07:27:04,059 [myid:1] – INFO [main:DataTree@1716] – The digest value is empty in snapshot
2023-09-25 07:27:04,067 [myid:1] – INFO [main:ZKDatabase@290] – Snapshot loaded in 22 ms, highest zxid is 0x0, digest is 1371985504
2023-09-25 07:27:04,072 [myid:1] – INFO [main:Server@375] – jetty-9.4.43.v20210629; built: 2021-06-30T11:07:22.254Z; git: 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8; jvm 11.0.16+8
2023-09-25 07:27:04,123 [myid:1] – INFO [main:DefaultSessionIdManager@334] – DefaultSessionIdManager workerName=node0
2023-09-25 07:27:04,123 [myid:1] – INFO [main:DefaultSessionIdManager@339] – No SessionScavenger set, using defaults
2023-09-25 07:27:04,125 [myid:1] – INFO [main:HouseKeeper@132] – node0 Scavenging every 660000ms
2023-09-25 07:27:04,135 [myid:1] – WARN [main:ConstraintSecurityHandler@759] – ServletContext@o.e.j.s.ServletContextHandler@6200f9cb{/,null,STARTING} has uncovered http methods for path: /*
2023-09-25 07:27:04,147 [myid:1] – INFO [main:ContextHandler@915] – Started o.e.j.s.ServletContextHandler@6200f9cb{/,null,AVAILABLE}
2023-09-25 07:27:04,154 [myid:1] – INFO [main:AbstractConnector@331] – Started ServerConnector@4802796d{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2023-09-25 07:27:04,154 [myid:1] – INFO [main:Server@415] – Started @1353ms
2023-09-25 07:27:04,155 [myid:1] – INFO [main:JettyAdminServer@190] – Started AdminServer on address 0.0.0.0, port 8080 and command URL /commands
2023-09-25 07:27:04,155 [myid:1] – INFO [main:QuorumPeer@2574] – Using 4000ms as the quorum cnxn socket timeout
2023-09-25 07:27:04,161 [myid:1] – INFO [main:QuorumCnxManager$Listener@924] – Election port bind maximum retries is 3
2023-09-25 07:27:04,173 [myid:1] – INFO [main:FastLeaderElection@89] – zookeeper.fastleader.minNotificationInterval=200
2023-09-25 07:27:04,173 [myid:1] – INFO [main:FastLeaderElection@91] – zookeeper.fastleader.maxNotificationInterval=60000
2023-09-25 07:27:04,181 [myid:1] – INFO [main:ZKAuditProvider@42] – ZooKeeper audit is disabled.
2023-09-25 07:27:04,191 [myid:1] – ERROR [ListenerHandler-/119.29.17.67:3888:QuorumCnxManager$Listener$ListenerHandler@1099] – Exception while listening
java.net.BindException: Cannot assign requested address (Bind failed)
at java.base/java.net.PlainSocketImpl.socketBind(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.bind(Unknown Source)
at java.base/java.net.ServerSocket.bind(Unknown Source)
at java.base/java.net.ServerSocket.bind(Unknown Source)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.createNewServerSocket(QuorumCnxManager.java:1141)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.acceptConnections(QuorumCnxManager.java:1070)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.run(QuorumCnxManager.java:1039)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2023-09-25 07:27:04,197 [myid:1] – INFO [QuorumPeermyid=1(secure=disabled):QuorumPeer@1438] – LOOKING
2023-09-25 07:27:04,206 [myid:1] – INFO [QuorumPeermyid=1(secure=disabled):FastLeaderElection@945] – New election. My id = 1, proposed zxid=0x0
2023-09-25 07:27:04,221 [myid:1] – INFO [WorkerReceiver[myid=1]:FastLeaderElection$Messenger$WorkerReceiver@390] – Notification: my state:LOOKING; n.sid:1, n.state:LOOKING, n.leader:1, n.round:0x1, n.peerEpoch:0x0, n.zxid:0x0, message format version:0x2, n.config version:0x0
2023-09-25 07:27:04,234 [myid:1] – WARN [QuorumConnectionThread-[myid=1]-1:QuorumCnxManager@401] – Cannot open channel to 2 at election address /182.61.40.160:3888
java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.initiateConnection(QuorumCnxManager.java:384)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$QuorumConnectionReqThread.run(QuorumCnxManager.java:458)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2023-09-25 07:27:04,423 [myid:1] – INFO [QuorumPeermyid=1(secure=disabled):FastLeaderElection@980] – Notification time out: 400
2023-09-25 07:27:04,435 [myid:1] – WARN [QuorumConnectionThread-[myid=1]-2:QuorumCnxManager@401] – Cannot open channel to 2 at election address /182.61.40.160:3888
java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.initiateConnection(QuorumCnxManager.java:384)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$QuorumConnectionReqThread.run(QuorumCnxManager.java:458)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2023-09-25 07:27:04,825 [myid:1] – INFO [QuorumPeermyid=1(secure=disabled):FastLeaderElection@980] – Notification time out: 800
2023-09-25 07:27:04,837 [myid:1] – WARN [QuorumConnectionThread-[myid=1]-3:QuorumCnxManager@401] – Cannot open channel to 2 at election address /182.61.40.160:3888
java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.initiateConnection(QuorumCnxManager.java:384)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$QuorumConnectionReqThread.run(QuorumCnxManager.java:458)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2023-09-25 07:27:05,201 [myid:1] – ERROR [ListenerHandler-/119.29.17.67:3888:QuorumCnxManager$Listener$ListenerHandler@1099] – Exception while listening
java.net.BindException: Cannot assign requested address (Bind failed)
at java.base/java.net.PlainSocketImpl.socketBind(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.bind(Unknown Source)
at java.base/java.net.ServerSocket.bind(Unknown Source)
at java.base/java.net.ServerSocket.bind(Unknown Source)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.createNewServerSocket(QuorumCnxManager.java:1141)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.acceptConnections(QuorumCnxManager.java:1070)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.run(QuorumCnxManager.java:1039)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2023-09-25 07:27:05,625 [myid:1] – INFO [QuorumPeermyid=1(secure=disabled):FastLeaderElection@980] – Notification time out: 1600
2023-09-25 07:27:05,638 [myid:1] – WARN [QuorumConnectionThread-[myid=1]-3:QuorumCnxManager@401] – Cannot open channel to 2 at election address /182.61.40.160:3888
java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.initiateConnection(QuorumCnxManager.java:384)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$QuorumConnectionReqThread.run(QuorumCnxManager.java:458)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2023-09-25 07:27:06,202 [myid:1] – ERROR [ListenerHandler-/119.29.17.67:3888:QuorumCnxManager$Listener$ListenerHandler@1099] – Exception while listening
java.net.BindException: Cannot assign requested address (Bind failed)
at java.base/java.net.PlainSocketImpl.socketBind(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.bind(Unknown Source)
at java.base/java.net.ServerSocket.bind(Unknown Source)
at java.base/java.net.ServerSocket.bind(Unknown Source)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.createNewServerSocket(QuorumCnxManager.java:1141)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.acceptConnections(QuorumCnxManager.java:1070)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.run(QuorumCnxManager.java:1039)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2023-09-25 07:27:07,204 [myid:1] – ERROR [ListenerHandler-/119.29.17.67:3888:QuorumCnxManager$Listener$ListenerHandler@1118] – Leaving listener thread for address 119.29.17.67:3888 after 3 errors. Use zookeeper.electionPortBindRetry property to increase retry count.
2023-09-25 07:27:07,205 [myid:1] – INFO [QuorumPeerListener:QuorumCnxManager$Listener@985] – Leaving listener
2023-09-25 07:27:07,206 [myid:1] – ERROR [QuorumPeerListener:QuorumCnxManager$Listener@987] – As I’m leaving the listener thread, I won’t be able to participate in leader election any longer: 119.29.17.67:3888
2023-09-25 07:27:07,207 [myid:1] – ERROR [QuorumPeerListener:ServiceUtils@48] – Exiting JVM with code 14
这些日志看起来是与 ZooKeeper 的错误消息有关,特别是与 QuorumCnxManager 相关的错误消息。这些错误表明 ZooKeeper 服务在处理与其它 ZooKeeper 实例之间的连接时遇到了问题。
根据日志信息,其中一个提示是:
plaintextCopy codeUse zookeeper.electionPortBindRetry property to increase retry count.
这个提示建议您可以使用 zookeeper.electionPortBindRetry
属性来增加连接重试的次数。这个属性是用来配置 ZooKeeper 选举端口的重试次数,您可以根据需要调整这个值。
要解决这个问题,您可以按照以下步骤进行操作:
- 打开 ZooKeeper 的配置文件(通常是
zoo.cfg
),查找zookeeper.electionPortBindRetry
属性。 - 增加重试次数的值,例如,将其从默认值(可能是 3)增加到更大的值,比如 5 或 10。
- 保存配置文件并重启 ZooKeeper 服务。
这样做后,ZooKeeper 将尝试更多次的连接来解决选举端口绑定的问题。
另外,请确保检查网络和防火墙设置,以确保端口 3888
是可以访问的,并且没有被阻止或限制。
先开一下端口试试看