kafaka
STEP 1: GET KAFKA
tar -zxvf kafka_2.12-2.4.1.tgz -C ../export/servers/
cd kafka_2.12-2.4.1/
STEP 2: START THE KAFKA ENVIRONMENT
# Start the ZooKeeper service
$ bin/zookeeper-server-start.sh config/zookeeper.properties
# Start the Kafka broker service
$ bin/kafka-server-start.sh config/server.properties
STEP 3: CREATE A TOPIC TO STORE YOUR EVENTS
这里"events"应翻译中文为"消息"
$ bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server localhost:9092
STEP 4: WRITE SOME EVENTS INTO THE TOPIC
$ bin/kafka-console-producer.sh --topic quickstart-events --bootstrap-server localhost:9092
# 出错:"bootstrap-server is not a recognized option"
# 2.5版本之前使用"broker-list",之后用"bootstrap-server"
# 当前版本2.4.1
STEP 5: READ THE EVENTS
$ bin/kafka-console-consumer.sh --topic quickstart-events --from-beginning --bootstrap-server localhost:9092
STEP 6: TERMINATE THE KAFKA ENVIRONMENT
Stop the producer and consumer clients with Ctrl-C, if you haven't done so already.
Stop the Kafka broker with Ctrl-C.
Lastly, if the Kafka with ZooKeeper section was followed, stop the ZooKeeper server with Ctrl-C.
rm -rf /tmp/kafka-logs /tmp/zookeeper