Apache Kafka Install

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Apache Kafka Install相关的知识,希望对你有一定的参考价值。

1.修改每台服务器config/server.properties

broker.id:唯一,填数字

host.name:填写服务器IP

zookeeper.connect=192.168.1.100:2181,192.168.1.101:2181,192.168.1.103:2181


2.启动

先启动zookeeper服务

bin/zkServer.sh start

再在每台机器上执行Kafka服务

bin/kafka-server-start.sh config/server.properties


3.创建topic

bin/kafka-topics.sh —create —zookeeper localhost:2181 —replication-factor 3 —partitions 1 —topic demo_1


4.查看topic

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


5.查看详细信息

bin/kafka-topics.sh —describe —zookeeper 192.168.1.100:2181


6.发送消息

bin/kafka-console-producer.sh —broker-list 192.168.1.100:9092 —topic demo_1


7.接收消息

bin/kafka-console-consumer.sh —zookeeper 192.168.1.100:2181 —topic demo_1 —from-beginning


以上是关于Apache Kafka Install的主要内容,如果未能解决你的问题,请参考以下文章

Flink实战系列Lorg/apache/flink/kafka/shaded/org/apache/kafka/clients/consumer/ConsumerRecord;)Ljava/

Apache Kafka教程

Apache Kafka用例

org.apache.kafka.common.KafkaException: 无法构造 kafka 消费者

技术实战 |《Apache Kafka实战》作者胡夕:Apache Kafka监控与调优

Kafka Producer - org.apache.kafka.common.serialization.StringSerializer 找不到