一、下载安装
到 Kafka 官网下载:https://kafka.apache.org/downloads
下载好 tar包 后,执行下面命令解压:
tar -zxvf xxx.tar
二、启动Zookeeper
进入Kafka 的 bin 目录,执行如下命令:
./zookeeper-server-start.sh ../config/zookeeper.properties &
执行结果:
[2022-03-11 17:20:30,410] INFO Reading configuration from: ../config/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,411] WARN ../config/zookeeper.properties is relative. Prepend ./ to indicate that you're sure! (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,422] INFO clientPortAddress is 0.0.0.0:2181 (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,423] INFO secureClientPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,423] INFO observerMasterPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,423] INFO metricsProvider.className is org.apache.zookeeper.metrics.impl.DefaultMetricsProvider (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,424] INFO autopurge.snapRetainCount set to 3 (org.apache.zookeeper.server.DatadirCleanupManager)
[2022-03-11 17:20:30,424] INFO autopurge.purgeInterval set to 0 (org.apache.zookeeper.server.DatadirCleanupManager)
[2022-03-11 17:20:30,424] INFO Purge task is not scheduled. (org.apache.zookeeper.server.DatadirCleanupManager)
[2022-03-11 17:20:30,424] WARN Either no config or no quorum defined in config, running in standalone mode (org.apache.zookeeper.server.quorum.QuorumPeerMain)
[2022-03-11 17:20:30,428] INFO Log4j 1.2 jmx support found and enabled. (org.apache.zookeeper.jmx.ManagedUtil)
[2022-03-11 17:20:30,440] INFO Reading configuration from: ../config/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,440] WARN ../config/zookeeper.properties is relative. Prepend ./ to indicate that you're sure! (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,441] INFO clientPortAddress is 0.0.0.0:2181 (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,441] INFO secureClientPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,441] INFO observerMasterPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,441] INFO metricsProvider.className is org.apache.zookeeper.metrics.impl.DefaultMetricsProvider (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2022-03-11 17:20:30,441] INFO Starting server (org.apache.zookeeper.server.ZooKeeperServerMain)
[2022-03-11 17:20:30,453] INFO ServerMetrics initialized with provider org.apache.zookeeper.metrics.impl.DefaultMetricsProvider@15975490 (org.apache.zookeeper.server.ServerMetrics)
[2022-03-11 17:20:30,457] INFO zookeeper.snapshot.trust.empty : false (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
[2022-03-11 17:20:30,473] INFO (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:30,473] INFO ______ _ (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:30,473] INFO |___ / | | (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:30,473] INFO / / ___ ___ | | __ ___ ___ _ __ ___ _ __ (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:30,473] INFO / / / _ \ / _ \ | |/ / / _ \ / _ \ | '_ \ / _ \ | '__| (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:30,473] INFO / /__ | (_) | | (_) | | < | __/ | __/ | |_) | | __/ | | (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:30,473] INFO /_____| \___/ \___/ |_|\_\ \___| \___| | .__/ \___| |_| (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:30,473] INFO | | (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:30,473] INFO |_| (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:30,473] INFO (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,480] INFO Server environment:zookeeper.version=3.6.3--6401e4ad2087061bc6b9f80dec2d69f2e3c8660a, built on 04/08/2021 16:35 GMT (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,480] INFO Server environment:host.name=10.0.22.112 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,480] INFO Server environment:java.version=1.8.0_121 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,480] INFO Server environment:java.vendor=Oracle Corporation (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,480] INFO Server environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,481] INFO Server environment:java.class.path=/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/activation-1.1.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/aopalliance-repackaged-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/argparse4j-0.7.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/audience-annotations-0.5.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/commons-cli-1.4.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/commons-lang3-3.8.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-api-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-basic-auth-extension-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-file-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-json-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-mirror-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-mirror-client-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-runtime-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-transforms-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/hk2-api-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/hk2-locator-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/hk2-utils-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-annotations-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-core-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-databind-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-dataformat-csv-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-datatype-jdk8-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-jaxrs-base-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-jaxrs-json-provider-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-module-jaxb-annotations-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-module-scala_2.12-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.activation-api-1.2.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.annotation-api-1.3.5.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.inject-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.validation-api-2.0.2.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.ws.rs-api-2.1.6.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.xml.bind-api-2.3.2.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/javassist-3.27.0-GA.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/javax.servlet-api-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/javax.ws.rs-api-2.1.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jaxb-api-2.3.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-client-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-common-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-container-servlet-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-container-servlet-core-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-hk2-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-server-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-client-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-continuation-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-http-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-io-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-security-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-server-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-servlet-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-servlets-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-util-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-util-ajax-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jline-3.12.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jopt-simple-5.0.4.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jose4j-0.7.8.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-clients-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-log4j-appender-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-metadata-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-raft-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-server-common-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-shell-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-storage-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-storage-api-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-streams-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-streams-examples-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-streams-scala_2.12-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-streams-test-utils-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-tools-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka_2.12-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/log4j-1.2.17.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/lz4-java-1.8.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/maven-artifact-3.8.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/metrics-core-2.2.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/metrics-core-4.1.12.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-buffer-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-codec-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-common-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-handler-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-resolver-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-transport-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-transport-native-epoll-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-transport-native-unix-common-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/osgi-resource-locator-1.0.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/paranamer-2.8.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/plexus-utils-3.2.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/reflections-0.9.12.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/rocksdbjni-6.22.1.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-collection-compat_2.12-2.4.4.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-java8-compat_2.12-1.0.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-library-2.12.14.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-logging_2.12-3.9.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-reflect-2.12.14.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/slf4j-api-1.7.30.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/slf4j-log4j12-1.7.30.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/snappy-java-1.1.8.4.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/trogdor-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/zookeeper-3.6.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/zookeeper-jute-3.6.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/zstd-jni-1.5.0-4.jar (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,482] INFO Server environment:java.library.path=/Users/davis/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,482] INFO Server environment:java.io.tmpdir=/var/folders/5n/6g464jd97r13x39t5w69ybfr0000gn/T/ (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,482] INFO Server environment:java.compiler=<NA> (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,482] INFO Server environment:os.name=Mac OS X (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,482] INFO Server environment:os.arch=x86_64 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO Server environment:os.version=10.15.5 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO Server environment:user.name=davis (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO Server environment:user.home=/Users/davis (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO Server environment:user.dir=/Users/davis/soft/kafka/kafka_3.1.0/bin (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO Server environment:os.memory.free=494MB (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO Server environment:os.memory.max=512MB (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO Server environment:os.memory.total=512MB (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO zookeeper.enableEagerACLCheck = false (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO zookeeper.digest.enabled = true (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO zookeeper.closeSessionTxn.enabled = true (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,483] INFO zookeeper.flushDelay=0 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,484] INFO zookeeper.maxWriteQueuePollTime=0 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,484] INFO zookeeper.maxBatchSize=1000 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,484] INFO zookeeper.intBufferStartingSizeBytes = 1024 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,485] INFO Weighed connection throttling is disabled (org.apache.zookeeper.server.BlueThrottle)
[2022-03-11 17:20:35,486] INFO minSessionTimeout set to 6000 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,487] INFO maxSessionTimeout set to 60000 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,488] INFO Response cache size is initialized with value 400. (org.apache.zookeeper.server.ResponseCache)
[2022-03-11 17:20:35,488] INFO Response cache size is initialized with value 400. (org.apache.zookeeper.server.ResponseCache)
[2022-03-11 17:20:35,489] INFO zookeeper.pathStats.slotCapacity = 60 (org.apache.zookeeper.server.util.RequestPathMetricsCollector)
[2022-03-11 17:20:35,489] INFO zookeeper.pathStats.slotDuration = 15 (org.apache.zookeeper.server.util.RequestPathMetricsCollector)
[2022-03-11 17:20:35,490] INFO zookeeper.pathStats.maxDepth = 6 (org.apache.zookeeper.server.util.RequestPathMetricsCollector)
[2022-03-11 17:20:35,490] INFO zookeeper.pathStats.initialDelay = 5 (org.apache.zookeeper.server.util.RequestPathMetricsCollector)
[2022-03-11 17:20:35,490] INFO zookeeper.pathStats.delay = 5 (org.apache.zookeeper.server.util.RequestPathMetricsCollector)
[2022-03-11 17:20:35,490] INFO zookeeper.pathStats.enabled = false (org.apache.zookeeper.server.util.RequestPathMetricsCollector)
[2022-03-11 17:20:35,493] INFO The max bytes for all large requests are set to 104857600 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,493] INFO The large request threshold is set to -1 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,493] INFO Created server with tickTime 3000 minSessionTimeout 6000 maxSessionTimeout 60000 clientPortListenBacklog -1 datadir /tmp/zookeeper/version-2 snapdir /tmp/zookeeper/version-2 (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,504] INFO Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory (org.apache.zookeeper.server.ServerCnxnFactory)
[2022-03-11 17:20:35,505] WARN maxCnxns is not configured, using default value 0. (org.apache.zookeeper.server.ServerCnxnFactory)
[2022-03-11 17:20:35,507] INFO Configuring NIO connection handler with 10s sessionless connection timeout, 2 selector thread(s), 16 worker threads, and 64 kB direct buffers. (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2022-03-11 17:20:35,515] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2022-03-11 17:20:35,532] INFO Using org.apache.zookeeper.server.watch.WatchManager as watch manager (org.apache.zookeeper.server.watch.WatchManagerFactory)
[2022-03-11 17:20:35,532] INFO Using org.apache.zookeeper.server.watch.WatchManager as watch manager (org.apache.zookeeper.server.watch.WatchManagerFactory)
[2022-03-11 17:20:35,532] INFO zookeeper.snapshotSizeFactor = 0.33 (org.apache.zookeeper.server.ZKDatabase)
[2022-03-11 17:20:35,532] INFO zookeeper.commitLogCount=500 (org.apache.zookeeper.server.ZKDatabase)
[2022-03-11 17:20:35,536] INFO zookeeper.snapshot.compression.method = CHECKED (org.apache.zookeeper.server.persistence.SnapStream)
[2022-03-11 17:20:35,538] INFO Reading snapshot /tmp/zookeeper/version-2/snapshot.0 (org.apache.zookeeper.server.persistence.FileSnap)
[2022-03-11 17:20:35,542] INFO The digest value is empty in snapshot (org.apache.zookeeper.server.DataTree)
[2022-03-11 17:20:35,571] INFO 29 txns loaded in 24 ms (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
[2022-03-11 17:20:35,571] INFO Snapshot loaded in 40 ms, highest zxid is 0x1d, digest is 51174012753 (org.apache.zookeeper.server.ZKDatabase)
[2022-03-11 17:20:35,572] INFO Snapshotting: 0x1d to /tmp/zookeeper/version-2/snapshot.1d (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
[2022-03-11 17:20:35,574] INFO Snapshot taken in 2 ms (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:35,584] INFO PrepRequestProcessor (sid:0) started, reconfigEnabled=false (org.apache.zookeeper.server.PrepRequestProcessor)
[2022-03-11 17:20:35,585] INFO zookeeper.request_throttler.shutdownTimeout = 10000 (org.apache.zookeeper.server.RequestThrottler)
[2022-03-11 17:20:35,598] INFO Using checkIntervalMs=60000 maxPerMinute=10000 maxNeverUsedIntervalMs=0 (org.apache.zookeeper.server.ContainerManager)
[2022-03-11 17:20:35,599] INFO ZooKeeper audit is disabled. (org.apache.zookeeper.audit.ZKAuditProvider)
[2022-03-11 17:20:54,971] INFO Expiring session 0x10072721ea90000, timeout of 18000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
[2022-03-11 17:20:54,974] INFO Creating new log file: log.1e (org.apache.zookeeper.server.persistence.FileTxnLog)
三、启动Kafka
进入Kafka 的 bin 目录,执行如下命令:
./kafka-server-start.sh ../config/server.properties &
执行结果:
[2022-03-11 17:21:45,472] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2022-03-11 17:21:45,964] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2022-03-11 17:21:46,054] INFO Registered signal handlers for TERM, INT, HUP (org.apache.kafka.common.utils.LoggingSignalHandler)
[2022-03-11 17:21:46,059] INFO starting (kafka.server.KafkaServer)
[2022-03-11 17:21:46,060] INFO Connecting to zookeeper on localhost:2181 (kafka.server.KafkaServer)
[2022-03-11 17:21:46,085] INFO [ZooKeeperClient Kafka server] Initializing a new session to localhost:2181. (kafka.zookeeper.ZooKeeperClient)
[2022-03-11 17:21:51,099] INFO Client environment:zookeeper.version=3.6.3--6401e4ad2087061bc6b9f80dec2d69f2e3c8660a, built on 04/08/2021 16:35 GMT (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,099] INFO Client environment:host.name=10.0.22.112 (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,100] INFO Client environment:java.version=1.8.0_121 (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,100] INFO Client environment:java.vendor=Oracle Corporation (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,100] INFO Client environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,100] INFO Client environment:java.class.path=/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/activation-1.1.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/aopalliance-repackaged-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/argparse4j-0.7.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/audience-annotations-0.5.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/commons-cli-1.4.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/commons-lang3-3.8.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-api-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-basic-auth-extension-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-file-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-json-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-mirror-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-mirror-client-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-runtime-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/connect-transforms-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/hk2-api-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/hk2-locator-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/hk2-utils-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-annotations-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-core-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-databind-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-dataformat-csv-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-datatype-jdk8-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-jaxrs-base-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-jaxrs-json-provider-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-module-jaxb-annotations-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jackson-module-scala_2.12-2.12.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.activation-api-1.2.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.annotation-api-1.3.5.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.inject-2.6.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.validation-api-2.0.2.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.ws.rs-api-2.1.6.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jakarta.xml.bind-api-2.3.2.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/javassist-3.27.0-GA.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/javax.servlet-api-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/javax.ws.rs-api-2.1.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jaxb-api-2.3.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-client-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-common-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-container-servlet-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-container-servlet-core-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-hk2-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jersey-server-2.34.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-client-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-continuation-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-http-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-io-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-security-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-server-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-servlet-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-servlets-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-util-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jetty-util-ajax-9.4.43.v20210629.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jline-3.12.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jopt-simple-5.0.4.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/jose4j-0.7.8.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-clients-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-log4j-appender-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-metadata-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-raft-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-server-common-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-shell-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-storage-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-storage-api-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-streams-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-streams-examples-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-streams-scala_2.12-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-streams-test-utils-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka-tools-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/kafka_2.12-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/log4j-1.2.17.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/lz4-java-1.8.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/maven-artifact-3.8.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/metrics-core-2.2.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/metrics-core-4.1.12.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-buffer-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-codec-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-common-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-handler-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-resolver-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-transport-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-transport-native-epoll-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/netty-transport-native-unix-common-4.1.68.Final.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/osgi-resource-locator-1.0.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/paranamer-2.8.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/plexus-utils-3.2.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/reflections-0.9.12.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/rocksdbjni-6.22.1.1.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-collection-compat_2.12-2.4.4.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-java8-compat_2.12-1.0.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-library-2.12.14.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-logging_2.12-3.9.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/scala-reflect-2.12.14.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/slf4j-api-1.7.30.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/slf4j-log4j12-1.7.30.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/snappy-java-1.1.8.4.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/trogdor-3.1.0.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/zookeeper-3.6.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/zookeeper-jute-3.6.3.jar:/Users/davis/soft/kafka/kafka_3.1.0/bin/../libs/zstd-jni-1.5.0-4.jar (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,101] INFO Client environment:java.library.path=/Users/davis/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,101] INFO Client environment:java.io.tmpdir=/var/folders/5n/6g464jd97r13x39t5w69ybfr0000gn/T/ (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,101] INFO Client environment:java.compiler=<NA> (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,101] INFO Client environment:os.name=Mac OS X (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,101] INFO Client environment:os.arch=x86_64 (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,101] INFO Client environment:os.version=10.15.5 (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,101] INFO Client environment:user.name=davis (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,101] INFO Client environment:user.home=/Users/davis (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,101] INFO Client environment:user.dir=/Users/davis/soft/kafka/kafka_3.1.0/bin (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,102] INFO Client environment:os.memory.free=1012MB (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,102] INFO Client environment:os.memory.max=1024MB (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,102] INFO Client environment:os.memory.total=1024MB (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,104] INFO Initiating client connection, connectString=localhost:2181 sessionTimeout=18000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$@36ebc363 (org.apache.zookeeper.ZooKeeper)
[2022-03-11 17:21:51,110] INFO jute.maxbuffer value is 4194304 Bytes (org.apache.zookeeper.ClientCnxnSocket)
[2022-03-11 17:21:51,114] INFO zookeeper.request.timeout value is 0. feature enabled=false (org.apache.zookeeper.ClientCnxn)
[2022-03-11 17:21:51,116] INFO [ZooKeeperClient Kafka server] Waiting until connected. (kafka.zookeeper.ZooKeeperClient)
[2022-03-11 17:21:51,120] INFO Opening socket connection to server localhost/127.0.0.1:2181. (org.apache.zookeeper.ClientCnxn)
[2022-03-11 17:21:51,120] INFO SASL config status: Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2022-03-11 17:21:51,131] INFO Socket connection established, initiating session, client: /127.0.0.1:54127, server: localhost/127.0.0.1:2181 (org.apache.zookeeper.ClientCnxn)
[2022-03-11 17:21:51,143] INFO Session establishment complete on server localhost/127.0.0.1:2181, session id = 0x100727923aa0000, negotiated timeout = 18000 (org.apache.zookeeper.ClientCnxn)
[2022-03-11 17:21:51,146] INFO [ZooKeeperClient Kafka server] Connected. (kafka.zookeeper.ZooKeeperClient)
[2022-03-11 17:21:51,223] INFO [feature-zk-node-event-process-thread]: Starting (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2022-03-11 17:21:51,378] INFO Updated cache from existing <empty> to latest FinalizedFeaturesAndEpoch(features=Features{}, epoch=0). (kafka.server.FinalizedFeatureCache)
[2022-03-11 17:21:51,382] INFO Cluster ID = 3D8RQ653S9exEPtwxVwuaQ (kafka.server.KafkaServer)
[2022-03-11 17:21:51,457] INFO KafkaConfig values:
advertised.listeners = null
alter.config.policy.class.name = null
alter.log.dirs.replication.quota.window.num = 11
alter.log.dirs.replication.quota.window.size.seconds = 1
authorizer.class.name =
auto.create.topics.enable = true
auto.leader.rebalance.enable = true
background.threads = 10
broker.heartbeat.interval.ms = 2000
broker.id = 0
broker.id.generation.enable = true
broker.rack = null
broker.session.timeout.ms = 9000
client.quota.callback.class = null
compression.type = producer
connection.failed.authentication.delay.ms = 100
connections.max.idle.ms = 600000
connections.max.reauth.ms = 0
control.plane.listener.name = null
controlled.shutdown.enable = true
controlled.shutdown.max.retries = 3
controlled.shutdown.retry.backoff.ms = 5000
controller.listener.names = null
controller.quorum.append.linger.ms = 25
controller.quorum.election.backoff.max.ms = 1000
controller.quorum.election.timeout.ms = 1000
controller.quorum.fetch.timeout.ms = 2000
controller.quorum.request.timeout.ms = 2000
controller.quorum.retry.backoff.ms = 20
controller.quorum.voters = []
controller.quota.window.num = 11
controller.quota.window.size.seconds = 1
controller.socket.timeout.ms = 30000
create.topic.policy.class.name = null
default.replication.factor = 1
delegation.token.expiry.check.interval.ms = 3600000
delegation.token.expiry.time.ms = 86400000
delegation.token.master.key = null
delegation.token.max.lifetime.ms = 604800000
delegation.token.secret.key = null
delete.records.purgatory.purge.interval.requests = 1
delete.topic.enable = true
fetch.max.bytes = 57671680
fetch.purgatory.purge.interval.requests = 1000
group.initial.rebalance.delay.ms = 0
group.max.session.timeout.ms = 1800000
group.max.size = 2147483647
group.min.session.timeout.ms = 6000
initial.broker.registration.timeout.ms = 60000
inter.broker.listener.name = null
inter.broker.protocol.version = 3.1-IV0
kafka.metrics.polling.interval.secs = 10
kafka.metrics.reporters = []
leader.imbalance.check.interval.seconds = 300
leader.imbalance.per.broker.percentage = 10
listener.security.protocol.map = PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL
listeners = PLAINTEXT://:9092
log.cleaner.backoff.ms = 15000
log.cleaner.dedupe.buffer.size = 134217728
log.cleaner.delete.retention.ms = 86400000
log.cleaner.enable = true
log.cleaner.io.buffer.load.factor = 0.9
log.cleaner.io.buffer.size = 524288
log.cleaner.io.max.bytes.per.second = 1.7976931348623157E308
log.cleaner.max.compaction.lag.ms = 9223372036854775807
log.cleaner.min.cleanable.ratio = 0.5
log.cleaner.min.compaction.lag.ms = 0
log.cleaner.threads = 1
log.cleanup.policy = [delete]
log.dir = /tmp/kafka-logs
log.dirs = /tmp/kafka-logs
log.flush.interval.messages = 9223372036854775807
log.flush.interval.ms = null
log.flush.offset.checkpoint.interval.ms = 60000
log.flush.scheduler.interval.ms = 9223372036854775807
log.flush.start.offset.checkpoint.interval.ms = 60000
log.index.interval.bytes = 4096
log.index.size.max.bytes = 10485760
log.message.downconversion.enable = true
log.message.format.version = 3.0-IV1
log.message.timestamp.difference.max.ms = 9223372036854775807
log.message.timestamp.type = CreateTime
log.preallocate = false
log.retention.bytes = -1
log.retention.check.interval.ms = 300000
log.retention.hours = 168
log.retention.minutes = null
log.retention.ms = null
log.roll.hours = 168
log.roll.jitter.hours = 0
log.roll.jitter.ms = null
log.roll.ms = null
log.segment.bytes = 1073741824
log.segment.delete.delay.ms = 60000
max.connection.creation.rate = 2147483647
max.connections = 2147483647
max.connections.per.ip = 2147483647
max.connections.per.ip.overrides =
max.incremental.fetch.session.cache.slots = 1000
message.max.bytes = 1048588
metadata.log.dir = null
metadata.log.max.record.bytes.between.snapshots = 20971520
metadata.log.segment.bytes = 1073741824
metadata.log.segment.min.bytes = 8388608
metadata.log.segment.ms = 604800000
metadata.max.retention.bytes = -1
metadata.max.retention.ms = 604800000
metric.reporters = []
metrics.num.samples = 2
metrics.recording.level = INFO
metrics.sample.window.ms = 30000
min.insync.replicas = 1
node.id = 0
num.io.threads = 8
num.network.threads = 3
num.partitions = 1
num.recovery.threads.per.data.dir = 1
num.replica.alter.log.dirs.threads = null
num.replica.fetchers = 1
offset.metadata.max.bytes = 4096
offsets.commit.required.acks = -1
offsets.commit.timeout.ms = 5000
offsets.load.buffer.size = 5242880
offsets.retention.check.interval.ms = 600000
offsets.retention.minutes = 10080
offsets.topic.compression.codec = 0
offsets.topic.num.partitions = 50
offsets.topic.replication.factor = 1
offsets.topic.segment.bytes = 104857600
password.encoder.cipher.algorithm = AES/CBC/PKCS5Padding
password.encoder.iterations = 4096
password.encoder.key.length = 128
password.encoder.keyfactory.algorithm = null
password.encoder.old.secret = null
password.encoder.secret = null
principal.builder.class = class org.apache.kafka.common.security.authenticator.DefaultKafkaPrincipalBuilder
process.roles = []
producer.purgatory.purge.interval.requests = 1000
queued.max.request.bytes = -1
queued.max.requests = 500
quota.window.num = 11
quota.window.size.seconds = 1
remote.log.index.file.cache.total.size.bytes = 1073741824
remote.log.manager.task.interval.ms = 30000
remote.log.manager.task.retry.backoff.max.ms = 30000
remote.log.manager.task.retry.backoff.ms = 500
remote.log.manager.task.retry.jitter = 0.2
remote.log.manager.thread.pool.size = 10
remote.log.metadata.manager.class.name = null
remote.log.metadata.manager.class.path = null
remote.log.metadata.manager.impl.prefix = null
remote.log.metadata.manager.listener.name = null
remote.log.reader.max.pending.tasks = 100
remote.log.reader.threads = 10
remote.log.storage.manager.class.name = null
remote.log.storage.manager.class.path = null
remote.log.storage.manager.impl.prefix = null
remote.log.storage.system.enable = false
replica.fetch.backoff.ms = 1000
replica.fetch.max.bytes = 1048576
replica.fetch.min.bytes = 1
replica.fetch.response.max.bytes = 10485760
replica.fetch.wait.max.ms = 500
replica.high.watermark.checkpoint.interval.ms = 5000
replica.lag.time.max.ms = 30000
replica.selector.class = null
replica.socket.receive.buffer.bytes = 65536
replica.socket.timeout.ms = 30000
replication.quota.window.num = 11
replication.quota.window.size.seconds = 1
request.timeout.ms = 30000
reserved.broker.max.id = 1000
sasl.client.callback.handler.class = null
sasl.enabled.mechanisms = [GSSAPI]
sasl.jaas.config = null
sasl.kerberos.kinit.cmd = /usr/bin/kinit
sasl.kerberos.min.time.before.relogin = 60000
sasl.kerberos.principal.to.local.rules = [DEFAULT]
sasl.kerberos.service.name = null
sasl.kerberos.ticket.renew.jitter = 0.05
sasl.kerberos.ticket.renew.window.factor = 0.8
sasl.login.callback.handler.class = null
sasl.login.class = null
sasl.login.connect.timeout.ms = null
sasl.login.read.timeout.ms = null
sasl.login.refresh.buffer.seconds = 300
sasl.login.refresh.min.period.seconds = 60
sasl.login.refresh.window.factor = 0.8
sasl.login.refresh.window.jitter = 0.05
sasl.login.retry.backoff.max.ms = 10000
sasl.login.retry.backoff.ms = 100
sasl.mechanism.controller.protocol = GSSAPI
sasl.mechanism.inter.broker.protocol = GSSAPI
sasl.oauthbearer.clock.skew.seconds = 30
sasl.oauthbearer.expected.audience = null
sasl.oauthbearer.expected.issuer = null
sasl.oauthbearer.jwks.endpoint.refresh.ms = 3600000
sasl.oauthbearer.jwks.endpoint.retry.backoff.max.ms = 10000
sasl.oauthbearer.jwks.endpoint.retry.backoff.ms = 100
sasl.oauthbearer.jwks.endpoint.url = null
sasl.oauthbearer.scope.claim.name = scope
sasl.oauthbearer.sub.claim.name = sub
sasl.oauthbearer.token.endpoint.url = null
sasl.server.callback.handler.class = null
security.inter.broker.protocol = PLAINTEXT
security.providers = null
socket.connection.setup.timeout.max.ms = 30000
socket.connection.setup.timeout.ms = 10000
socket.receive.buffer.bytes = 102400
socket.request.max.bytes = 104857600
socket.send.buffer.bytes = 102400
ssl.cipher.suites = []
ssl.client.auth = none
ssl.enabled.protocols = [TLSv1.2]
ssl.endpoint.identification.algorithm = https
ssl.engine.factory.class = null
ssl.key.password = null
ssl.keymanager.algorithm = SunX509
ssl.keystore.certificate.chain = null
ssl.keystore.key = null
ssl.keystore.location = null
ssl.keystore.password = null
ssl.keystore.type = JKS
ssl.principal.mapping.rules = DEFAULT
ssl.protocol = TLSv1.2
ssl.provider = null
ssl.secure.random.implementation = null
ssl.trustmanager.algorithm = PKIX
ssl.truststore.certificates = null
ssl.truststore.location = null
ssl.truststore.password = null
ssl.truststore.type = JKS
transaction.abort.timed.out.transaction.cleanup.interval.ms = 10000
transaction.max.timeout.ms = 900000
transaction.remove.expired.transaction.cleanup.interval.ms = 3600000
transaction.state.log.load.buffer.size = 5242880
transaction.state.log.min.isr = 1
transaction.state.log.num.partitions = 50
transaction.state.log.replication.factor = 1
transaction.state.log.segment.bytes = 104857600
transactional.id.expiration.ms = 604800000
unclean.leader.election.enable = false
zookeeper.clientCnxnSocket = null
zookeeper.connect = localhost:2181
zookeeper.connection.timeout.ms = 18000
zookeeper.max.in.flight.requests = 10
zookeeper.session.timeout.ms = 18000
zookeeper.set.acl = false
zookeeper.ssl.cipher.suites = null
zookeeper.ssl.client.enable = false
zookeeper.ssl.crl.enable = false
zookeeper.ssl.enabled.protocols = null
zookeeper.ssl.endpoint.identification.algorithm = HTTPS
zookeeper.ssl.keystore.location = null
zookeeper.ssl.keystore.password = null
zookeeper.ssl.keystore.type = null
zookeeper.ssl.ocsp.enable = false
zookeeper.ssl.protocol = TLSv1.2
zookeeper.ssl.truststore.location = null
zookeeper.ssl.truststore.password = null
zookeeper.ssl.truststore.type = null
zookeeper.sync.time.ms = 2000
(kafka.server.KafkaConfig)
[2022-03-11 17:21:51,467] INFO KafkaConfig values:
advertised.listeners = null
alter.config.policy.class.name = null
alter.log.dirs.replication.quota.window.num = 11
alter.log.dirs.replication.quota.window.size.seconds = 1
authorizer.class.name =
auto.create.topics.enable = true
auto.leader.rebalance.enable = true
background.threads = 10
broker.heartbeat.interval.ms = 2000
broker.id = 0
broker.id.generation.enable = true
broker.rack = null
broker.session.timeout.ms = 9000
client.quota.callback.class = null
compression.type = producer
connection.failed.authentication.delay.ms = 100
connections.max.idle.ms = 600000
connections.max.reauth.ms = 0
control.plane.listener.name = null
controlled.shutdown.enable = true
controlled.shutdown.max.retries = 3
controlled.shutdown.retry.backoff.ms = 5000
controller.listener.names = null
controller.quorum.append.linger.ms = 25
controller.quorum.election.backoff.max.ms = 1000
controller.quorum.election.timeout.ms = 1000
controller.quorum.fetch.timeout.ms = 2000
controller.quorum.request.timeout.ms = 2000
controller.quorum.retry.backoff.ms = 20
controller.quorum.voters = []
controller.quota.window.num = 11
controller.quota.window.size.seconds = 1
controller.socket.timeout.ms = 30000
create.topic.policy.class.name = null
default.replication.factor = 1
delegation.token.expiry.check.interval.ms = 3600000
delegation.token.expiry.time.ms = 86400000
delegation.token.master.key = null
delegation.token.max.lifetime.ms = 604800000
delegation.token.secret.key = null
delete.records.purgatory.purge.interval.requests = 1
delete.topic.enable = true
fetch.max.bytes = 57671680
fetch.purgatory.purge.interval.requests = 1000
group.initial.rebalance.delay.ms = 0
group.max.session.timeout.ms = 1800000
group.max.size = 2147483647
group.min.session.timeout.ms = 6000
initial.broker.registration.timeout.ms = 60000
inter.broker.listener.name = null
inter.broker.protocol.version = 3.1-IV0
kafka.metrics.polling.interval.secs = 10
kafka.metrics.reporters = []
leader.imbalance.check.interval.seconds = 300
leader.imbalance.per.broker.percentage = 10
listener.security.protocol.map = PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL
listeners = PLAINTEXT://:9092
log.cleaner.backoff.ms = 15000
log.cleaner.dedupe.buffer.size = 134217728
log.cleaner.delete.retention.ms = 86400000
log.cleaner.enable = true
log.cleaner.io.buffer.load.factor = 0.9
log.cleaner.io.buffer.size = 524288
log.cleaner.io.max.bytes.per.second = 1.7976931348623157E308
log.cleaner.max.compaction.lag.ms = 9223372036854775807
log.cleaner.min.cleanable.ratio = 0.5
log.cleaner.min.compaction.lag.ms = 0
log.cleaner.threads = 1
log.cleanup.policy = [delete]
log.dir = /tmp/kafka-logs
log.dirs = /tmp/kafka-logs
log.flush.interval.messages = 9223372036854775807
log.flush.interval.ms = null
log.flush.offset.checkpoint.interval.ms = 60000
log.flush.scheduler.interval.ms = 9223372036854775807
log.flush.start.offset.checkpoint.interval.ms = 60000
log.index.interval.bytes = 4096
log.index.size.max.bytes = 10485760
log.message.downconversion.enable = true
log.message.format.version = 3.0-IV1
log.message.timestamp.difference.max.ms = 9223372036854775807
log.message.timestamp.type = CreateTime
log.preallocate = false
log.retention.bytes = -1
log.retention.check.interval.ms = 300000
log.retention.hours = 168
log.retention.minutes = null
log.retention.ms = null
log.roll.hours = 168
log.roll.jitter.hours = 0
log.roll.jitter.ms = null
log.roll.ms = null
log.segment.bytes = 1073741824
log.segment.delete.delay.ms = 60000
max.connection.creation.rate = 2147483647
max.connections = 2147483647
max.connections.per.ip = 2147483647
max.connections.per.ip.overrides =
max.incremental.fetch.session.cache.slots = 1000
message.max.bytes = 1048588
metadata.log.dir = null
metadata.log.max.record.bytes.between.snapshots = 20971520
metadata.log.segment.bytes = 1073741824
metadata.log.segment.min.bytes = 8388608
metadata.log.segment.ms = 604800000
metadata.max.retention.bytes = -1
metadata.max.retention.ms = 604800000
metric.reporters = []
metrics.num.samples = 2
metrics.recording.level = INFO
metrics.sample.window.ms = 30000
min.insync.replicas = 1
node.id = 0
num.io.threads = 8
num.network.threads = 3
num.partitions = 1
num.recovery.threads.per.data.dir = 1
num.replica.alter.log.dirs.threads = null
num.replica.fetchers = 1
offset.metadata.max.bytes = 4096
offsets.commit.required.acks = -1
offsets.commit.timeout.ms = 5000
offsets.load.buffer.size = 5242880
offsets.retention.check.interval.ms = 600000
offsets.retention.minutes = 10080
offsets.topic.compression.codec = 0
offsets.topic.num.partitions = 50
offsets.topic.replication.factor = 1
offsets.topic.segment.bytes = 104857600
password.encoder.cipher.algorithm = AES/CBC/PKCS5Padding
password.encoder.iterations = 4096
password.encoder.key.length = 128
password.encoder.keyfactory.algorithm = null
password.encoder.old.secret = null
password.encoder.secret = null
principal.builder.class = class org.apache.kafka.common.security.authenticator.DefaultKafkaPrincipalBuilder
process.roles = []
producer.purgatory.purge.interval.requests = 1000
queued.max.request.bytes = -1
queued.max.requests = 500
quota.window.num = 11
quota.window.size.seconds = 1
remote.log.index.file.cache.total.size.bytes = 1073741824
remote.log.manager.task.interval.ms = 30000
remote.log.manager.task.retry.backoff.max.ms = 30000
remote.log.manager.task.retry.backoff.ms = 500
remote.log.manager.task.retry.jitter = 0.2
remote.log.manager.thread.pool.size = 10
remote.log.metadata.manager.class.name = null
remote.log.metadata.manager.class.path = null
remote.log.metadata.manager.impl.prefix = null
remote.log.metadata.manager.listener.name = null
remote.log.reader.max.pending.tasks = 100
remote.log.reader.threads = 10
remote.log.storage.manager.class.name = null
remote.log.storage.manager.class.path = null
remote.log.storage.manager.impl.prefix = null
remote.log.storage.system.enable = false
replica.fetch.backoff.ms = 1000
replica.fetch.max.bytes = 1048576
replica.fetch.min.bytes = 1
replica.fetch.response.max.bytes = 10485760
replica.fetch.wait.max.ms = 500
replica.high.watermark.checkpoint.interval.ms = 5000
replica.lag.time.max.ms = 30000
replica.selector.class = null
replica.socket.receive.buffer.bytes = 65536
replica.socket.timeout.ms = 30000
replication.quota.window.num = 11
replication.quota.window.size.seconds = 1
request.timeout.ms = 30000
reserved.broker.max.id = 1000
sasl.client.callback.handler.class = null
sasl.enabled.mechanisms = [GSSAPI]
sasl.jaas.config = null
sasl.kerberos.kinit.cmd = /usr/bin/kinit
sasl.kerberos.min.time.before.relogin = 60000
sasl.kerberos.principal.to.local.rules = [DEFAULT]
sasl.kerberos.service.name = null
sasl.kerberos.ticket.renew.jitter = 0.05
sasl.kerberos.ticket.renew.window.factor = 0.8
sasl.login.callback.handler.class = null
sasl.login.class = null
sasl.login.connect.timeout.ms = null
sasl.login.read.timeout.ms = null
sasl.login.refresh.buffer.seconds = 300
sasl.login.refresh.min.period.seconds = 60
sasl.login.refresh.window.factor = 0.8
sasl.login.refresh.window.jitter = 0.05
sasl.login.retry.backoff.max.ms = 10000
sasl.login.retry.backoff.ms = 100
sasl.mechanism.controller.protocol = GSSAPI
sasl.mechanism.inter.broker.protocol = GSSAPI
sasl.oauthbearer.clock.skew.seconds = 30
sasl.oauthbearer.expected.audience = null
sasl.oauthbearer.expected.issuer = null
sasl.oauthbearer.jwks.endpoint.refresh.ms = 3600000
sasl.oauthbearer.jwks.endpoint.retry.backoff.max.ms = 10000
sasl.oauthbearer.jwks.endpoint.retry.backoff.ms = 100
sasl.oauthbearer.jwks.endpoint.url = null
sasl.oauthbearer.scope.claim.name = scope
sasl.oauthbearer.sub.claim.name = sub
sasl.oauthbearer.token.endpoint.url = null
sasl.server.callback.handler.class = null
security.inter.broker.protocol = PLAINTEXT
security.providers = null
socket.connection.setup.timeout.max.ms = 30000
socket.connection.setup.timeout.ms = 10000
socket.receive.buffer.bytes = 102400
socket.request.max.bytes = 104857600
socket.send.buffer.bytes = 102400
ssl.cipher.suites = []
ssl.client.auth = none
ssl.enabled.protocols = [TLSv1.2]
ssl.endpoint.identification.algorithm = https
ssl.engine.factory.class = null
ssl.key.password = null
ssl.keymanager.algorithm = SunX509
ssl.keystore.certificate.chain = null
ssl.keystore.key = null
ssl.keystore.location = null
ssl.keystore.password = null
ssl.keystore.type = JKS
ssl.principal.mapping.rules = DEFAULT
ssl.protocol = TLSv1.2
ssl.provider = null
ssl.secure.random.implementation = null
ssl.trustmanager.algorithm = PKIX
ssl.truststore.certificates = null
ssl.truststore.location = null
ssl.truststore.password = null
ssl.truststore.type = JKS
transaction.abort.timed.out.transaction.cleanup.interval.ms = 10000
transaction.max.timeout.ms = 900000
transaction.remove.expired.transaction.cleanup.interval.ms = 3600000
transaction.state.log.load.buffer.size = 5242880
transaction.state.log.min.isr = 1
transaction.state.log.num.partitions = 50
transaction.state.log.replication.factor = 1
transaction.state.log.segment.bytes = 104857600
transactional.id.expiration.ms = 604800000
unclean.leader.election.enable = false
zookeeper.clientCnxnSocket = null
zookeeper.connect = localhost:2181
zookeeper.connection.timeout.ms = 18000
zookeeper.max.in.flight.requests = 10
zookeeper.session.timeout.ms = 18000
zookeeper.set.acl = false
zookeeper.ssl.cipher.suites = null
zookeeper.ssl.client.enable = false
zookeeper.ssl.crl.enable = false
zookeeper.ssl.enabled.protocols = null
zookeeper.ssl.endpoint.identification.algorithm = HTTPS
zookeeper.ssl.keystore.location = null
zookeeper.ssl.keystore.password = null
zookeeper.ssl.keystore.type = null
zookeeper.ssl.ocsp.enable = false
zookeeper.ssl.protocol = TLSv1.2
zookeeper.ssl.truststore.location = null
zookeeper.ssl.truststore.password = null
zookeeper.ssl.truststore.type = null
zookeeper.sync.time.ms = 2000
(kafka.server.KafkaConfig)
[2022-03-11 17:21:51,504] INFO [ThrottledChannelReaper-Fetch]: Starting (kafka.server.ClientQuotaManager$ThrottledChannelReaper)
[2022-03-11 17:21:51,505] INFO [ThrottledChannelReaper-Produce]: Starting (kafka.server.ClientQuotaManager$ThrottledChannelReaper)
[2022-03-11 17:21:51,507] INFO [ThrottledChannelReaper-Request]: Starting (kafka.server.ClientQuotaManager$ThrottledChannelReaper)
[2022-03-11 17:21:51,508] INFO [ThrottledChannelReaper-ControllerMutation]: Starting (kafka.server.ClientQuotaManager$ThrottledChannelReaper)
[2022-03-11 17:21:51,543] INFO Loading logs from log dirs ArrayBuffer(/tmp/kafka-logs) (kafka.log.LogManager)
[2022-03-11 17:21:51,546] INFO Attempting recovery for all logs in /tmp/kafka-logs since no clean shutdown file was found (kafka.log.LogManager)
[2022-03-11 17:21:51,557] INFO Loaded 0 logs in 15ms. (kafka.log.LogManager)
[2022-03-11 17:21:51,558] INFO Starting log cleanup with a period of 300000 ms. (kafka.log.LogManager)
[2022-03-11 17:21:51,561] INFO Starting log flusher with a default period of 9223372036854775807 ms. (kafka.log.LogManager)
[2022-03-11 17:21:51,881] INFO [BrokerToControllerChannelManager broker=0 name=forwarding]: Starting (kafka.server.BrokerToControllerRequestThread)
[2022-03-11 17:21:52,044] INFO Updated connection-accept-rate max connection creation rate to 2147483647 (kafka.network.ConnectionQuotas)
[2022-03-11 17:21:52,049] INFO Awaiting socket connections on 0.0.0.0:9092. (kafka.network.Acceptor)
[2022-03-11 17:21:52,078] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Created data-plane acceptor and processors for endpoint : ListenerName(PLAINTEXT) (kafka.network.SocketServer)
[2022-03-11 17:21:52,086] INFO [BrokerToControllerChannelManager broker=0 name=alterIsr]: Starting (kafka.server.BrokerToControllerRequestThread)
[2022-03-11 17:21:52,111] INFO [ExpirationReaper-0-Produce]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
[2022-03-11 17:21:52,112] INFO [ExpirationReaper-0-Fetch]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
[2022-03-11 17:21:52,113] INFO [ExpirationReaper-0-DeleteRecords]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
[2022-03-11 17:21:52,114] INFO [ExpirationReaper-0-ElectLeader]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
[2022-03-11 17:21:52,129] INFO [LogDirFailureHandler]: Starting (kafka.server.ReplicaManager$LogDirFailureHandler)
[2022-03-11 17:21:57,176] INFO Creating /brokers/ids/0 (is it secure? false) (kafka.zk.KafkaZkClient)
[2022-03-11 17:21:57,197] INFO Stat of the created znode at /brokers/ids/0 is: 46,46,1646990517190,1646990517190,1,0,0,72183458652880896,206,0,46
(kafka.zk.KafkaZkClient)
[2022-03-11 17:21:57,198] INFO Registered broker 0 at path /brokers/ids/0 with addresses: PLAINTEXT://10.0.22.112:9092, czxid (broker epoch): 46 (kafka.zk.KafkaZkClient)
[2022-03-11 17:21:57,261] INFO [ExpirationReaper-0-topic]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
[2022-03-11 17:21:57,270] INFO [ExpirationReaper-0-Heartbeat]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
[2022-03-11 17:21:57,271] INFO [ExpirationReaper-0-Rebalance]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
[2022-03-11 17:21:57,306] INFO [GroupCoordinator 0]: Starting up. (kafka.coordinator.group.GroupCoordinator)
[2022-03-11 17:21:57,314] INFO [GroupCoordinator 0]: Startup complete. (kafka.coordinator.group.GroupCoordinator)
[2022-03-11 17:21:57,335] INFO [TransactionCoordinator id=0] Starting up. (kafka.coordinator.transaction.TransactionCoordinator)
[2022-03-11 17:21:57,339] INFO [Transaction Marker Channel Manager 0]: Starting (kafka.coordinator.transaction.TransactionMarkerChannelManager)
[2022-03-11 17:21:57,339] INFO [TransactionCoordinator id=0] Startup complete. (kafka.coordinator.transaction.TransactionCoordinator)
[2022-03-11 17:21:57,376] INFO [ExpirationReaper-0-AlterAcls]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
[2022-03-11 17:21:57,404] INFO [/config/changes-event-process-thread]: Starting (kafka.common.ZkNodeChangeNotificationListener$ChangeEventProcessThread)
[2022-03-11 17:21:57,417] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Starting socket server acceptors and processors (kafka.network.SocketServer)
[2022-03-11 17:21:57,423] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Started data-plane acceptor and processor(s) for endpoint : ListenerName(PLAINTEXT) (kafka.network.SocketServer)
[2022-03-11 17:21:57,424] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Started socket server acceptors and processors (kafka.network.SocketServer)
[2022-03-11 17:21:57,429] INFO Kafka version: 3.1.0 (org.apache.kafka.common.utils.AppInfoParser)
[2022-03-11 17:21:57,430] INFO Kafka commitId: 37edeed0777bacb3 (org.apache.kafka.common.utils.AppInfoParser)
[2022-03-11 17:21:57,430] INFO Kafka startTimeMs: 1646990517425 (org.apache.kafka.common.utils.AppInfoParser)
[2022-03-11 17:21:57,432] INFO [KafkaServer id=0] started (kafka.server.KafkaServer)
[2022-03-11 17:21:57,537] INFO [BrokerToControllerChannelManager broker=0 name=forwarding]: Recorded new controller, from now on will use broker 10.0.22.112:9092 (id: 0 rack: null) (kafka.server.BrokerToControllerRequestThread)
[2022-03-11 17:21:57,537] INFO [BrokerToControllerChannelManager broker=0 name=alterIsr]: Recorded new controller, from now on will use broker 10.0.22.112:9092 (id: 0 rack: null) (kafka.server.BrokerToControllerRequestThread)
? ~/soft/kafka/kafka_3.1.0/bin [2022-03-11 17:30:22,980] INFO Creating topic javaTopic with configuration {} and initial partition assignment Map(1 -> ArrayBuffer(0), 0 -> ArrayBuffer(0)) (kafka.zk.AdminZkClient)
[2022-03-11 17:30:23,077] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions Set(javaTopic-0, javaTopic-1) (kafka.server.ReplicaFetcherManager)
[2022-03-11 17:30:23,146] INFO [LogLoader partition=javaTopic-0, dir=/tmp/kafka-logs] Loading producer state till offset 0 with message format version 2 (kafka.log.UnifiedLog$)
[2022-03-11 17:30:23,164] INFO Created log for partition javaTopic-0 in /tmp/kafka-logs/javaTopic-0 with properties {} (kafka.log.LogManager)
[2022-03-11 17:30:23,165] INFO [Partition javaTopic-0 broker=0] No checkpointed highwatermark is found for partition javaTopic-0 (kafka.cluster.Partition)
[2022-03-11 17:30:23,166] INFO [Partition javaTopic-0 broker=0] Log loaded for partition javaTopic-0 with initial high watermark 0 (kafka.cluster.Partition)
[2022-03-11 17:30:23,195] INFO [LogLoader partition=javaTopic-1, dir=/tmp/kafka-logs] Loading producer state till offset 0 with message format version 2 (kafka.log.UnifiedLog$)
[2022-03-11 17:30:23,195] INFO Created log for partition javaTopic-1 in /tmp/kafka-logs/javaTopic-1 with properties {} (kafka.log.LogManager)
[2022-03-11 17:30:23,196] INFO [Partition javaTopic-1 broker=0] No checkpointed highwatermark is found for partition javaTopic-1 (kafka.cluster.Partition)
[2022-03-11 17:30:23,196] INFO [Partition javaTopic-1 broker=0] Log loaded for partition javaTopic-1 with initial high watermark 0 (kafka.cluster.Partition)
四、创建Topic
我安装的Kafka版本是:2.13。
进入Kafka 的 bin 目录,执行如下命令:
./kafka-topics.sh --bootstrap-server localhost:9092 --create --topic javaTopic --partitions 2 --replication-factor 1
执行结果:
Created topic javaTopic.
Kafka版本小于2.2版本的创建命令如下:
./kafka-topics.sh --zookeeper localhost:2181 --create --toptic javaTopic --partitions 2 --replication-factor 1
注:2.2以及更高版本使用如上命令的话,会报如下错误:
Exception in thread "main" joptsimple.UnrecognizedOptionException: zookeeper is not a recognized option
at joptsimple.OptionException.unrecognizedOption(OptionException.java:108)
at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:510)
at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:56)
at joptsimple.OptionParser.parse(OptionParser.java:396)
at kafka.admin.TopicCommand$TopicCommandOptions.<init>(TopicCommand.scala:567)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:47)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
五、查看Topic
进入Kafka 的 bin 目录,执行如下命令:
./kafka-topics.sh --list --bootstrap-server localhost:9092
执行结果:
javaTopic
六、生产/消费数据
进入Kafka 的 bin 目录,打开两个终端,分别执行如下命令:
生产者命令:
./kafka-console-producer.sh --broker-list localhost:9092 --topic javaTopic
./kafka-console-producer.sh --zookeeper localhost:9092 --topic javaTopic
消费者命令:
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic javaTopic
./kafka-console-consumer.sh --zookeeper localhost:9092 --topic javaTopic
然后在生产者终端中随便输入,然后回车,在消费者终端界面出现生产者终端输入的内容,则说明消费成功。
|