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
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
版权归原作者 磕磕唠 所有, 如有侵权,请联系我们删除。