kraft单机安装kafka无需安装zookeeper(Kafka2.8版本之后支持)

2024-04-15 08:02:33 浏览数 (2)

kraft单机安装kafka无需安装zookeeper(Kafka2.8版本之后支持)

下载

官网地址: http://kafka.apache.org/downloads.html

这里选择的是kafka_2.12-3.6.0.tgz

创建kafka相关目录

代码语言:javascript复制
mkdir -p /usr/local/kafka/kafka_2.12-3.6.0

上传安装包并解压

代码语言:javascript复制
tar -zxvf kafka_2.12-3.6.0.tgz -C /usr/local/kafka/ -C /usr/local/kafka/

生成uuid

代码语言:javascript复制
sh /usr/local/kafka/kafka_2.12-3.6.0/bin/kafka-storage.sh random-uuid
代码语言:javascript复制
[root@localhost bin]# sh /usr/local/kafka/kafka_2.12-3.6.0/bin/kafka-storage.sh random-uuid
C4mOgAy4TouDNwkz_35D0A
[root@localhost bin]#

格式化存储目录

代码语言:javascript复制
sh /usr/local/kafka/kafka_2.12-3.6.0/bin/kafka-storage.sh format -t C4mOgAy4TouDNwkz_35D0A -c /usr/local/kafka/kafka_2.12-3.6.0/config/kraft/server.properties
代码语言:javascript复制
[root@localhost kraft]# sh /usr/local/kafka/kafka_2.12-3.6.0/bin/kafka-storage.sh format -t C4mOgAy4TouDNwkz_35D0A -c /usr/local/kafka/kafka_2.12-3.6.0/config/kraft/server.properties
Formatting /tmp/kraft-combined-logs with metadata.version 3.6-IV2.
[root@localhost kraft]#

后台启动kafka

代码语言:javascript复制
sh /usr/local/kafka/kafka_2.12-3.6.0/bin/kafka-server-start.sh -daemon /usr/local/kafka/kafka_2.12-3.6.0/config/kraft/server.properties &

查看启动日志

代码语言:javascript复制
tail -f /usr/local/kafka/kafka_2.12-3.6.0/logs/server.log

停止kafka

代码语言:javascript复制
sh /usr/local/kafka/kafka_2.12-3.6.0/bin/kafka-server-stop.sh

0 人点赞