kafka cluster installation

Modify the config/server.properties

broker.id of each server: unique, fill in the numbers, respectively 101,102,103 in this article

host.name: fill in the server IP
zookeeper.connect=hadoop1:2181,hadoop2:2181,hadoop3:2181
Start the zookeeper service first : zkServer.sh start
and then execute on each machine: bin/kafka-server-start.sh config/server.properties 

Create topic:
h kafka-create-topic.sh --zookeeper hadoop1:2181,hadoop2:2181,hadoop3 :2181 --topic mykafka

show Topic: mykafka
sh kafka-list-topic.sh --zookeeper hadoop1:2181,hadoop2:2181,hadoop3:2181


Send message:

sh kafka-console-producer.sh --broker-list hadoop2: 9092 --topic mykafka

23423
Receive message:
sh kafka-console-consumer.sh --zookeeper hadoop1:2181,hadoop2:2181,hadoop3:2181 --topic mykafka --from-beginning

23423







Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326269610&siteId=291194637