kafka认知--(1)
文檔參考:http://kafka.apache.org/documentation.html
下載代碼:
tar -xzf kafka_2.11-0.11.0.0.tgz
cd kafka_2.11-0.11.0.0
啟動(dòng)
bin/zookeeper-server-start.sh config/zookeeper.properties
創(chuàng)建topic(主題為test,只有一個(gè)分區(qū),一個(gè)副本)
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
查看topic
bin/kafka-topics.sh --list --zookeeper localhost:2181
發(fā)送消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
啟動(dòng)消費(fèi)者
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
?
設(shè)置多集群:
config/server.properties config/server-1.properties
config/server.properties config/server-2.properties
配置文件
config/server-1.properties:
????broker.id=1 ????listeners=PLAINTEXT://:9093 ????log.dir=/tmp/kafka-logs-1 config/server-2.properties: ????broker.id=2 ????listeners=PLAINTEXT://:9094 ????log.dir=/tmp/kafka-logs-2 該broker.id屬性是集群中的每個(gè)節(jié)點(diǎn)的唯一和永久的名字?
轉(zhuǎn)載于:https://www.cnblogs.com/liutiantian/p/7262213.html
總結(jié)
以上是生活随笔為你收集整理的kafka认知--(1)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 平安标准信用卡分期怎么申请?分期类型介绍
- 下一篇: 数据同步 rsync+notify架构