要在Ubuntu上安装Apache Kafka,请按照以下步骤操作:
1、安装Java运行时环境(Ubuntu):
如果已经安装jdk不用执行
#ubuntu sudo apt update sudo apt install default-jre #centos8 sudo dnfupdate sudo dnf install java-1.8.0-openjdk-devel
2、下载Kafka:
wget https://downloads.apache.org/kafka/3.5.1/kafka_2.12-3.5.1.tgz
3、解压下载的文件:
tar -xzf kafka_2.12-3.5.1.tgz
4、进入Kafka目录:
cd kafka_2.12-3.5.1
5、启动Zookeeper服务器。在单独的终端窗口中执行以下命令:
bin/zookeeper-server-start.sh config/zookeeper.properties
root@ubuntu2203:/usr/local/kafka_2.12-3.5.1# bin/zookeeper-server-start.sh config/zookeeper.properties [2023-07-29 08:22:37,807] INFO Reading configuration from: config/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,810] WARN config/zookeeper.properties is relative. Prepend ./ to indicate that you're sure! (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,817] INFO clientPortAddress is 0.0.0.0:2181 (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,818] INFO secureClientPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,818] INFO observerMasterPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,818] INFO metricsProvider.className is org.apache.zookeeper.metrics.impl.DefaultMetricsProvider (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,822] INFO autopurge.snapRetainCount set to 3 (org.apache.zookeeper.server.DatadirCleanupManager) [2023-07-29 08:22:37,822] INFO autopurge.purgeInterval set to 0 (org.apache.zookeeper.server.DatadirCleanupManager) [2023-07-29 08:22:37,822] INFO Purge task is not scheduled. (org.apache.zookeeper.server.DatadirCleanupManager) [2023-07-29 08:22:37,822] WARN Either no config or no quorum defined in config, running in standalone mode (org.apache.zookeeper.server.quorum.QuorumPeerMain) [2023-07-29 08:22:37,824] INFO Log4j 1.2 jmx support not found; jmx disabled. (org.apache.zookeeper.jmx.ManagedUtil) [2023-07-29 08:22:37,825] INFO Reading configuration from: config/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,825] WARN config/zookeeper.properties is relative. Prepend ./ to indicate that you're sure! (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,826] INFO clientPortAddress is 0.0.0.0:2181 (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,826] INFO secureClientPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,826] INFO observerMasterPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,826] INFO metricsProvider.className is org.apache.zookeeper.metrics.impl.DefaultMetricsProvider (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2023-07-29 08:22:37,827] INFO Starting server (org.apache.zookeeper.server.ZooKeeperServerMain) [2023-07-29 08:22:37,852] INFO ServerMetrics initialized with provider org.apache.zookeeper.metrics.impl.DefaultMetricsProvider@23282c25 (org.apache.zookeeper.server.ServerMetrics) [2023-07-29 08:22:37,858] INFO zookeeper.snapshot.trust.empty : false (org.apache.zookeeper.server.persistence.FileTxnSnapLog) [2023-07-29 08:22:37,872] INFO (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,872] INFO ______ _ (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,872] INFO |___ / | | (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,872] INFO / / ___ ___ | | __ ___ ___ _ __ ___ _ __ (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,872] INFO / / / _ \ / _ \ | |/ / / _ \ / _ \ | '_ \ / _ \ | '__| (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,872] INFO / /__ | (_) | | (_) | | < | __/ | __/ | |_) | | __/ | | (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,872] INFO /_____| \___/ \___/ |_|\_\ \___| \___| | .__/ \___| |_| (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,872] INFO | | (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,872] INFO |_| (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,873] INFO (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,898] INFO Server environment:zookeeper.version=3.6.4--d65253dcf68e9097c6e95a126463fd5fdeb4521c, built on 12/18/2022 18:10 GMT (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,898] INFO Server environment:host.name=ubuntu2203 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,899] INFO Server environment:java.version=11.0.19 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,899] INFO Server environment:java.vendor=Ubuntu (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:java.home=/usr/lib/jvm/java-11-openjdk-amd64 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:java.class.path=/usr/local/kafka_2.12-3.5.1/bin/../libs/activation-1.1.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/aopalliance-repackaged-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/argparse4j-0.7.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/audience-annotations-0.13.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/commons-cli-1.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/commons-lang3-3.8.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-api-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-basic-auth-extension-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-json-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-mirror-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-mirror-client-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-runtime-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-transforms-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/hk2-api-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/hk2-locator-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/hk2-utils-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-annotations-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-core-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-databind-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-dataformat-csv-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-datatype-jdk8-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-jaxrs-base-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-jaxrs-json-provider-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-module-jaxb-annotations-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-module-scala_2.12-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.activation-api-1.2.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.annotation-api-1.3.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.inject-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.validation-api-2.0.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.ws.rs-api-2.1.6.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.xml.bind-api-2.3.3.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javassist-3.29.2-GA.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javax.activation-api-1.2.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javax.annotation-api-1.3.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javax.servlet-api-3.1.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javax.ws.rs-api-2.1.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jaxb-api-2.3.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-client-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-common-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-container-servlet-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-container-servlet-core-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-hk2-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-server-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-client-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-continuation-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-http-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-io-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-security-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-server-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-servlet-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-servlets-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-util-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-util-ajax-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jline-3.22.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jopt-simple-5.0.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jose4j-0.9.3.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka_2.12-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-clients-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-group-coordinator-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-log4j-appender-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-metadata-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-raft-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-server-common-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-shell-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-storage-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-storage-api-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-streams-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-streams-examples-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-streams-scala_2.12-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-streams-test-utils-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-tools-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-tools-api-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/lz4-java-1.8.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/maven-artifact-3.8.8.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/metrics-core-2.2.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/metrics-core-4.1.12.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-buffer-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-codec-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-common-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-handler-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-resolver-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-transport-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-transport-classes-epoll-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-transport-native-epoll-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-transport-native-unix-common-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/osgi-resource-locator-1.0.3.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/paranamer-2.8.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/plexus-utils-3.3.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/reflections-0.9.12.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/reload4j-1.2.25.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/rocksdbjni-7.1.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-collection-compat_2.12-2.10.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-java8-compat_2.12-1.0.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-library-2.12.15.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-logging_2.12-3.9.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-reflect-2.12.15.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/slf4j-api-1.7.36.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/slf4j-reload4j-1.7.36.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/snappy-java-1.1.10.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/swagger-annotations-2.2.8.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/trogdor-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/zookeeper-3.6.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/zookeeper-jute-3.6.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/zstd-jni-1.5.5-1.jar (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:java.library.path=/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:java.io.tmpdir=/tmp (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:java.compiler=<NA> (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:os.name=Linux (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:os.arch=amd64 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:os.version=5.19.0-50-generic (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:user.name=root (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:user.home=/root (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,900] INFO Server environment:user.dir=/usr/local/kafka_2.12-3.5.1 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,901] INFO Server environment:os.memory.free=490MB (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,901] INFO Server environment:os.memory.max=512MB (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,901] INFO Server environment:os.memory.total=512MB (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,901] INFO zookeeper.enableEagerACLCheck = false (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,902] INFO zookeeper.digest.enabled = true (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,902] INFO zookeeper.closeSessionTxn.enabled = true (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,902] INFO zookeeper.flushDelay=0 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,902] INFO zookeeper.maxWriteQueuePollTime=0 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,903] INFO zookeeper.maxBatchSize=1000 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,903] INFO zookeeper.intBufferStartingSizeBytes = 1024 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,905] INFO Weighed connection throttling is disabled (org.apache.zookeeper.server.BlueThrottle) [2023-07-29 08:22:37,907] INFO minSessionTimeout set to 6000 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,907] INFO maxSessionTimeout set to 60000 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,909] INFO Response cache size is initialized with value 400. (org.apache.zookeeper.server.ResponseCache) [2023-07-29 08:22:37,910] INFO Response cache size is initialized with value 400. (org.apache.zookeeper.server.ResponseCache) [2023-07-29 08:22:37,911] INFO zookeeper.pathStats.slotCapacity = 60 (org.apache.zookeeper.server.util.RequestPathMetricsCollector) [2023-07-29 08:22:37,911] INFO zookeeper.pathStats.slotDuration = 15 (org.apache.zookeeper.server.util.RequestPathMetricsCollector) [2023-07-29 08:22:37,911] INFO zookeeper.pathStats.maxDepth = 6 (org.apache.zookeeper.server.util.RequestPathMetricsCollector) [2023-07-29 08:22:37,911] INFO zookeeper.pathStats.initialDelay = 5 (org.apache.zookeeper.server.util.RequestPathMetricsCollector) [2023-07-29 08:22:37,912] INFO zookeeper.pathStats.delay = 5 (org.apache.zookeeper.server.util.RequestPathMetricsCollector) [2023-07-29 08:22:37,912] INFO zookeeper.pathStats.enabled = false (org.apache.zookeeper.server.util.RequestPathMetricsCollector) [2023-07-29 08:22:37,919] INFO The max bytes for all large requests are set to 104857600 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,919] INFO The large request threshold is set to -1 (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:37,919] 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) [2023-07-29 08:22:37,942] INFO Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory (org.apache.zookeeper.server.ServerCnxnFactory) [2023-07-29 08:22:37,945] WARN maxCnxns is not configured, using default value 0. (org.apache.zookeeper.server.ServerCnxnFactory) [2023-07-29 08:22:37,947] INFO Configuring NIO connection handler with 10s sessionless connection timeout, 1 selector thread(s), 4 worker threads, and 64 kB direct buffers. (org.apache.zookeeper.server.NIOServerCnxnFactory) [2023-07-29 08:22:37,958] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory) [2023-07-29 08:22:37,982] INFO Using org.apache.zookeeper.server.watch.WatchManager as watch manager (org.apache.zookeeper.server.watch.WatchManagerFactory) [2023-07-29 08:22:37,982] INFO Using org.apache.zookeeper.server.watch.WatchManager as watch manager (org.apache.zookeeper.server.watch.WatchManagerFactory) [2023-07-29 08:22:37,988] INFO zookeeper.snapshotSizeFactor = 0.33 (org.apache.zookeeper.server.ZKDatabase) [2023-07-29 08:22:37,988] INFO zookeeper.commitLogCount=500 (org.apache.zookeeper.server.ZKDatabase) [2023-07-29 08:22:38,002] INFO zookeeper.snapshot.compression.method = CHECKED (org.apache.zookeeper.server.persistence.SnapStream) [2023-07-29 08:22:38,002] INFO Snapshotting: 0x0 to /tmp/zookeeper/version-2/snapshot.0 (org.apache.zookeeper.server.persistence.FileTxnSnapLog) [2023-07-29 08:22:38,008] INFO Snapshot loaded in 19 ms, highest zxid is 0x0, digest is 1371985504 (org.apache.zookeeper.server.ZKDatabase) [2023-07-29 08:22:38,008] INFO Snapshotting: 0x0 to /tmp/zookeeper/version-2/snapshot.0 (org.apache.zookeeper.server.persistence.FileTxnSnapLog) [2023-07-29 08:22:38,009] INFO Snapshot taken in 1 ms (org.apache.zookeeper.server.ZooKeeperServer) [2023-07-29 08:22:38,033] INFO zookeeper.request_throttler.shutdownTimeout = 10000 (org.apache.zookeeper.server.RequestThrottler) [2023-07-29 08:22:38,033] INFO PrepRequestProcessor (sid:0) started, reconfigEnabled=false (org.apache.zookeeper.server.PrepRequestProcessor) [2023-07-29 08:22:38,091] INFO Using checkIntervalMs=60000 maxPerMinute=10000 maxNeverUsedIntervalMs=0 (org.apache.zookeeper.server.ContainerManager) [2023-07-29 08:22:38,092] INFO ZooKeeper audit is disabled. (org.apache.zookeeper.audit.ZKAuditProvider) [2023-07-29 08:23:02,288] INFO Creating new log file: log.1 (org.apache.zookeeper.server.persistence.FileTxnLog)
6、启动Kafka服务器。在另一个终端窗口中执行以下命令:
bin/kafka-server-start.sh config/server.properties
root@ubuntu2203:/usr/local/kafka_2.12-3.5.1# bin/kafka-server-start.sh config/server.properties [2023-07-29 08:23:01,586] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$) [2023-07-29 08:23:02,087] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util) [2023-07-29 08:23:02,177] INFO Registered signal handlers for TERM, INT, HUP (org.apache.kafka.common.utils.LoggingSignalHandler) [2023-07-29 08:23:02,179] INFO starting (kafka.server.KafkaServer) [2023-07-29 08:23:02,180] INFO Connecting to zookeeper on localhost:2181 (kafka.server.KafkaServer) [2023-07-29 08:23:02,200] INFO [ZooKeeperClient Kafka server] Initializing a new session to localhost:2181. (kafka.zookeeper.ZooKeeperClient) [2023-07-29 08:23:02,214] INFO Client environment:zookeeper.version=3.6.4--d65253dcf68e9097c6e95a126463fd5fdeb4521c, built on 12/18/2022 18:10 GMT (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,215] INFO Client environment:host.name=ubuntu2203 (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,215] INFO Client environment:java.version=11.0.19 (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,215] INFO Client environment:java.vendor=Ubuntu (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,215] INFO Client environment:java.home=/usr/lib/jvm/java-11-openjdk-amd64 (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,215] INFO Client environment:java.class.path=/usr/local/kafka_2.12-3.5.1/bin/../libs/activation-1.1.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/aopalliance-repackaged-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/argparse4j-0.7.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/audience-annotations-0.13.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/commons-cli-1.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/commons-lang3-3.8.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-api-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-basic-auth-extension-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-json-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-mirror-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-mirror-client-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-runtime-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/connect-transforms-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/hk2-api-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/hk2-locator-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/hk2-utils-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-annotations-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-core-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-databind-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-dataformat-csv-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-datatype-jdk8-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-jaxrs-base-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-jaxrs-json-provider-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-module-jaxb-annotations-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jackson-module-scala_2.12-2.13.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.activation-api-1.2.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.annotation-api-1.3.5.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.inject-2.6.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.validation-api-2.0.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.ws.rs-api-2.1.6.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jakarta.xml.bind-api-2.3.3.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javassist-3.29.2-GA.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javax.activation-api-1.2.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javax.annotation-api-1.3.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javax.servlet-api-3.1.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/javax.ws.rs-api-2.1.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jaxb-api-2.3.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-client-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-common-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-container-servlet-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-container-servlet-core-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-hk2-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jersey-server-2.39.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-client-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-continuation-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-http-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-io-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-security-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-server-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-servlet-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-servlets-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-util-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jetty-util-ajax-9.4.51.v20230217.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jline-3.22.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jopt-simple-5.0.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/jose4j-0.9.3.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka_2.12-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-clients-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-group-coordinator-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-log4j-appender-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-metadata-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-raft-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-server-common-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-shell-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-storage-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-storage-api-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-streams-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-streams-examples-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-streams-scala_2.12-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-streams-test-utils-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-tools-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/kafka-tools-api-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/lz4-java-1.8.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/maven-artifact-3.8.8.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/metrics-core-2.2.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/metrics-core-4.1.12.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-buffer-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-codec-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-common-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-handler-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-resolver-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-transport-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-transport-classes-epoll-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-transport-native-epoll-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/netty-transport-native-unix-common-4.1.94.Final.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/osgi-resource-locator-1.0.3.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/paranamer-2.8.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/plexus-utils-3.3.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/reflections-0.9.12.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/reload4j-1.2.25.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/rocksdbjni-7.1.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-collection-compat_2.12-2.10.0.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-java8-compat_2.12-1.0.2.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-library-2.12.15.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-logging_2.12-3.9.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/scala-reflect-2.12.15.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/slf4j-api-1.7.36.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/slf4j-reload4j-1.7.36.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/snappy-java-1.1.10.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/swagger-annotations-2.2.8.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/trogdor-3.5.1.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/zookeeper-3.6.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/zookeeper-jute-3.6.4.jar:/usr/local/kafka_2.12-3.5.1/bin/../libs/zstd-jni-1.5.5-1.jar (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,216] INFO Client environment:java.library.path=/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,216] INFO Client environment:java.io.tmpdir=/tmp (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,216] INFO Client environment:java.compiler=<NA> (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,216] INFO Client environment:os.name=Linux (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,217] INFO Client environment:os.arch=amd64 (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,217] INFO Client environment:os.version=5.19.0-50-generic (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,217] INFO Client environment:user.name=root (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,217] INFO Client environment:user.home=/root (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,217] INFO Client environment:user.dir=/usr/local/kafka_2.12-3.5.1 (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,217] INFO Client environment:os.memory.free=972MB (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,218] INFO Client environment:os.memory.max=1024MB (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,218] INFO Client environment:os.memory.total=1024MB (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,223] INFO Initiating client connection, connectString=localhost:2181 sessionTimeout=18000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$@50313382 (org.apache.zookeeper.ZooKeeper) [2023-07-29 08:23:02,238] INFO jute.maxbuffer value is 4194304 Bytes (org.apache.zookeeper.ClientCnxnSocket) [2023-07-29 08:23:02,248] INFO zookeeper.request.timeout value is 0. feature enabled=false (org.apache.zookeeper.ClientCnxn) [2023-07-29 08:23:02,253] INFO [ZooKeeperClient Kafka server] Waiting until connected. (kafka.zookeeper.ZooKeeperClient) [2023-07-29 08:23:02,259] INFO Opening socket connection to server localhost/127.0.0.1:2181. (org.apache.zookeeper.ClientCnxn) [2023-07-29 08:23:02,274] INFO Socket connection established, initiating session, client: /127.0.0.1:36080, server: localhost/127.0.0.1:2181 (org.apache.zookeeper.ClientCnxn) [2023-07-29 08:23:02,305] INFO Session establishment complete on server localhost/127.0.0.1:2181, session id = 0x100001b5f850000, negotiated timeout = 18000 (org.apache.zookeeper.ClientCnxn) [2023-07-29 08:23:02,310] INFO [ZooKeeperClient Kafka server] Connected. (kafka.zookeeper.ZooKeeperClient) [2023-07-29 08:23:02,565] INFO Cluster ID = hfzaja9tQf-FzxKNUMCT5A (kafka.server.KafkaServer) [2023-07-29 08:23:02,569] WARN No meta.properties file under dir /tmp/kafka-logs/meta.properties (kafka.server.BrokerMetadataCheckpoint) [2023-07-29 08:23:02,667] 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.include.jmx.reporter = 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 early.start.listeners = null fetch.max.bytes = 57671680 fetch.purgatory.purge.interval.requests = 1000 group.consumer.assignors = [] group.consumer.heartbeat.interval.ms = 5000 group.consumer.max.heartbeat.interval.ms = 15000 group.consumer.max.session.timeout.ms = 60000 group.consumer.max.size = 2147483647 group.consumer.min.heartbeat.interval.ms = 5000 group.consumer.min.session.timeout.ms = 45000 group.consumer.session.timeout.ms = 45000 group.coordinator.new.enable = false group.coordinator.threads = 1 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.5-IV2 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.max.snapshot.interval.ms = 3600000 metadata.log.segment.bytes = 1073741824 metadata.log.segment.min.bytes = 8388608 metadata.log.segment.ms = 604800000 metadata.max.idle.interval.ms = 500 metadata.max.retention.bytes = 104857600 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.id.expiration.check.interval.ms = 600000 producer.id.expiration.ms = 86400000 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 sasl.server.max.receive.size = 524288 security.inter.broker.protocol = PLAINTEXT security.providers = null server.max.startup.time.ms = 9223372036854775807 socket.connection.setup.timeout.max.ms = 30000 socket.connection.setup.timeout.ms = 10000 socket.listen.backlog.size = 50 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, TLSv1.3] 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.3 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 unstable.api.versions.enable = false zookeeper.clientCnxnSocket = null zookeeper.connect = localhost:2181 zookeeper.connection.timeout.ms = 18000 zookeeper.max.in.flight.requests = 10 zookeeper.metadata.migration.enable = false 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 (kafka.server.KafkaConfig) [2023-07-29 08:23:02,751] INFO [ThrottledChannelReaper-Fetch]: Starting (kafka.server.ClientQuotaManager$ThrottledChannelReaper) [2023-07-29 08:23:02,755] INFO [ThrottledChannelReaper-Request]: Starting (kafka.server.ClientQuotaManager$ThrottledChannelReaper) [2023-07-29 08:23:02,762] INFO [ThrottledChannelReaper-Produce]: Starting (kafka.server.ClientQuotaManager$ThrottledChannelReaper) [2023-07-29 08:23:02,765] INFO [ThrottledChannelReaper-ControllerMutation]: Starting (kafka.server.ClientQuotaManager$ThrottledChannelReaper) [2023-07-29 08:23:02,784] INFO Log directory /tmp/kafka-logs not found, creating it. (kafka.log.LogManager) [2023-07-29 08:23:02,809] INFO Loading logs from log dirs ArrayBuffer(/tmp/kafka-logs) (kafka.log.LogManager) [2023-07-29 08:23:02,816] INFO No logs found to be loaded in /tmp/kafka-logs (kafka.log.LogManager) [2023-07-29 08:23:02,833] INFO Loaded 0 logs in 23ms (kafka.log.LogManager) [2023-07-29 08:23:02,836] INFO Starting log cleanup with a period of 300000 ms. (kafka.log.LogManager) [2023-07-29 08:23:02,839] INFO Starting log flusher with a default period of 9223372036854775807 ms. (kafka.log.LogManager) [2023-07-29 08:23:02,923] INFO [kafka-log-cleaner-thread-0]: Starting (kafka.log.LogCleaner$CleanerThread) [2023-07-29 08:23:02,969] INFO [feature-zk-node-event-process-thread]: Starting (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread) [2023-07-29 08:23:02,996] INFO Feature ZK node at path: /feature does not exist (kafka.server.FinalizedFeatureChangeListener) [2023-07-29 08:23:03,029] INFO [zk-broker-0-to-controller-forwarding-channel-manager]: Starting (kafka.server.BrokerToControllerRequestThread) [2023-07-29 08:23:03,468] INFO Updated connection-accept-rate max connection creation rate to 2147483647 (kafka.network.ConnectionQuotas) [2023-07-29 08:23:03,491] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Created data-plane acceptor and processors for endpoint : ListenerName(PLAINTEXT) (kafka.network.SocketServer) [2023-07-29 08:23:03,506] INFO [zk-broker-0-to-controller-alter-partition-channel-manager]: Starting (kafka.server.BrokerToControllerRequestThread) [2023-07-29 08:23:03,539] INFO [ExpirationReaper-0-Produce]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper) [2023-07-29 08:23:03,540] INFO [ExpirationReaper-0-Fetch]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper) [2023-07-29 08:23:03,543] INFO [ExpirationReaper-0-DeleteRecords]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper) [2023-07-29 08:23:03,547] INFO [ExpirationReaper-0-ElectLeader]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper) [2023-07-29 08:23:03,565] INFO [LogDirFailureHandler]: Starting (kafka.server.ReplicaManager$LogDirFailureHandler) [2023-07-29 08:23:03,592] INFO Creating /brokers/ids/0 (is it secure? false) (kafka.zk.KafkaZkClient) [2023-07-29 08:23:03,615] INFO Stat of the created znode at /brokers/ids/0 is: 25,25,1690590183606,1690590183606,1,0,0,72057711604596736,204,0,25 (kafka.zk.KafkaZkClient) [2023-07-29 08:23:03,617] INFO Registered broker 0 at path /brokers/ids/0 with addresses: PLAINTEXT://ubuntu2203:9092, czxid (broker epoch): 25 (kafka.zk.KafkaZkClient) [2023-07-29 08:23:03,714] INFO [ExpirationReaper-0-topic]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper) [2023-07-29 08:23:03,721] INFO [ExpirationReaper-0-Heartbeat]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper) [2023-07-29 08:23:03,732] INFO [ExpirationReaper-0-Rebalance]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper) [2023-07-29 08:23:03,739] INFO Successfully created /controller_epoch with initial epoch 0 (kafka.zk.KafkaZkClient) [2023-07-29 08:23:03,761] INFO Feature ZK node created at path: /feature (kafka.server.FinalizedFeatureChangeListener) [2023-07-29 08:23:03,777] INFO [GroupCoordinator 0]: Starting up. (kafka.coordinator.group.GroupCoordinator) [2023-07-29 08:23:03,787] INFO [GroupCoordinator 0]: Startup complete. (kafka.coordinator.group.GroupCoordinator) [2023-07-29 08:23:03,803] INFO [TransactionCoordinator id=0] Starting up. (kafka.coordinator.transaction.TransactionCoordinator) [2023-07-29 08:23:03,812] INFO [MetadataCache brokerId=0] Updated cache from existing <empty> to latest FinalizedFeaturesAndEpoch(features=Map(), epoch=0). (kafka.server.metadata.ZkMetadataCache) [2023-07-29 08:23:03,817] INFO [TransactionCoordinator id=0] Startup complete. (kafka.coordinator.transaction.TransactionCoordinator) [2023-07-29 08:23:03,825] INFO [TxnMarkerSenderThread-0]: Starting (kafka.coordinator.transaction.TransactionMarkerChannelManager) [2023-07-29 08:23:03,867] INFO [ExpirationReaper-0-AlterAcls]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper) [2023-07-29 08:23:03,930] INFO [/config/changes-event-process-thread]: Starting (kafka.common.ZkNodeChangeNotificationListener$ChangeEventProcessThread) [2023-07-29 08:23:03,965] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Enabling request processing. (kafka.network.SocketServer) [2023-07-29 08:23:03,973] INFO Awaiting socket connections on 0.0.0.0:9092. (kafka.network.DataPlaneAcceptor) [2023-07-29 08:23:04,105] INFO Kafka version: 3.5.1 (org.apache.kafka.common.utils.AppInfoParser) [2023-07-29 08:23:04,106] INFO Kafka commitId: 2c6fb6c54472e90a (org.apache.kafka.common.utils.AppInfoParser) [2023-07-29 08:23:04,106] INFO Kafka startTimeMs: 1690590184097 (org.apache.kafka.common.utils.AppInfoParser) [2023-07-29 08:23:04,118] INFO [KafkaServer id=0] started (kafka.server.KafkaServer) [2023-07-29 08:23:04,172] INFO [zk-broker-0-to-controller-forwarding-channel-manager]: Recorded new controller, from now on will use node ubuntu2203:9092 (id: 0 rack: null) (kafka.server.BrokerToControllerRequestThread) [2023-07-29 08:23:04,217] INFO [zk-broker-0-to-controller-alter-partition-channel-manager]: Recorded new controller, from now on will use node ubuntu2203:9092 (id: 0 rack: null) (kafka.server.BrokerToControllerRequestThread)
现在,Kafka已成功安装并在本地运行。
注意:默认情况下,Kafka会使用本地文件系统作为消息存储和日志存储。如果你希望修改配置,请编辑config/server.properties
文件进行相应的更改。
如果你需要创建主题(topic)、发送消息、消费消息等操作,请参考Kafka的官方文档进行相应的配置和使用。
Connection to node 0 (/127.0.0.1:9092)
#进入kafka安装目录 /usr/local/kafka_2.12-3.5.1/config #编辑配置文件 vim server.properties
# 允许外部端口连接 listeners=PLAINTEXT://0.0.0.0:9092 # 外部代理地址 advertised.listeners=PLAINTEXT://192.168.157.101:9092