CentOS 7 搭建 kafka 2.12-2.3.0 集群

参考文档:
https://www.cnblogs.com/longBlogs/p/10340251.html
https://www.cnblogs.com/QuestionsZhang/p/10271196.html


补充:
在node100上面配置好了之后,将整个文件拷到node200,node300
注意:
node200server.propertie需要修改

broker.id=2
listeners=PLAINTEXT://node200:9092

node300server.propertie需要修改

broker.id=3
listeners=PLAINTEXT://node300:9092

否则报错:

ERROR [KafkaServer id=2] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
org.apache.kafka.common.KafkaException: Socket server failed to bind to node100:9092: Cannot assign requested address.

使用kafka tool 查看kafka报错unable to connect to broker 1,原因不明,但是使用生产者和消费者可以正常使用

# 生产者发送消息

./bin/kafka-console-producer.sh --broker-list 192.168.89.11:9092 --topic topic_name

# 消费者消费消息

./bin/kafka-console-consumer.sh --bootstrap-server 192.168.89.11:9092,192.168.89.12:9092,192.168.89.13:9092 --topic topic_name

 # 删除topic

./bin/kafka-topics.sh --delete --topictopic_name --zookeeper 192.168.89.11:2181,192.168.89.12:2181,192.168.89.13:2181

# 创建topic

./bin/kafka-topics.sh --create --zookeeper  192.168.89.11:2181,192.168.89.12:2181,192.168.89.13:2181  --replication-factor 1 --partitions 1 --topic topic_name

你可能感兴趣的:(大数据)