一、环境介绍

zookeeper下载地址:https://zookeeper.apache.org/releases.html

kafka下载地址:https://kafka.apache.org/downloads

192.168.142.129     apache-zookeeper-3.8.4-bin.tar.gz    kafka_2.13-3.6.0.tgz

192.168.142.130    apache-zookeeper-3.8.4-bin.tar.gz    kafka_2.13-3.6.0.tgz

192.168.142.131    apache-zookeeper-3.8.4-bin.tar.gz    kafka_2.13-3.6.0.tgz

二、kafka单机环境使用

1.启动服务
单机环境使用kafka自带的zookeeper
tar zxf kafka_2.13-3.6.0.tgz -C /usr/local/
cd /usr/local/kafka_2.13-3.6.0/
nohup bin/zookeeper-server-start.sh config/zookeeper.properties &
nohup bin/kafka-server-start.sh config/server.properties &
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.

kafka使用以及基于zookeeper集群搭建集群环境_kafka

2.创建topic
bin/kafka-topics.sh --create --topic test --bootstrap-server localhost:9092       
bin/kafka-topi