1.创建安装目录/usr/local/kafka
mkdir /usr/local/kafka
2.进入安装包目录
cd /usr/local/kafka
3.下载安装包
wget https://downloads.apache.org/kafka/3.3.1/kafka_2.12-3.3.1.tgz
4.解压安装包
tar -zxvf kafka_2.12-3.3.1.tgz
5.进入cd kafka_2.12-3.3.1目录
cd kafka_2.12-3.3.1/
6.修改zookeeper配置
cat ./config/zookeeper.properties | grep -v '#' >> ./config/zk.properties
7.启动zookeeper
bin/zookeeper-server-start.sh config/zk.properties &
8.修改kafka配置
cat ./config/server.properties | grep -v '#' >> ./config/ka.properties
9.启动kafka
bin/kafka-server-start.sh config/server.properties &
10.创建topic
bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --partitions 2 --replication-factor 1 --topic test
文章来源地址https://www.toymoban.com/news/detail-416094.html
11.创建生产者,启动producer
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
12.创建消费者,启动consumer
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
文章来源:https://www.toymoban.com/news/detail-416094.html
到了这里,关于Linux安装Kafka,创建topic、生产者、消费者的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!