kafka installation to create a theme to send a message

download

https://mirrors.aliyun.com/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz

wget https://mirrors.aliyun.com/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz

Decompression

tar zxvf kafka_2.12-2.3.0.tgz -C/opt

start up

cd /opt/kafka_2.12-2.3.0/bin
./zookeeper-server-start.sh -daemon ../config/zookeeper.properties
./kafka-server-start.sh ../config/server.properties

UTOOLS1583045409173.png

Creating topic

./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

UTOOLS1583045464945.png

View topic

./kafka-topics.sh --list --zookeeper localhost:2181

UTOOLS1583045518437.png

send messages

/kafka-console-producer.sh --broker-list localhost:9092 --topic test

UTOOLS1583045892137.png

Receive messages

./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

UTOOLS1583045909703.png

Guess you like

Origin www.cnblogs.com/lzyuid/p/12403174.html