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