Kafka讀書筆記 -- 安裝與配置
摘要:
Kafka使用Zookeeper儲存叢集的 元資料資訊 和 消費者資訊
安裝Zookeeper和Kafka
➜~ brew install kafka
==> Installing dependencies for kafka: zookee...
Kafka使用Zookeeper儲存叢集的 元資料資訊 和 消費者資訊
安裝Zookeeper和Kafka
➜~ brew install kafka ==> Installing dependencies for kafka: zookeeper ==> Caveats ==> zookeeper To have launchd start zookeeper now and restart at login: brew services start zookeeper Or, if you don't want/need a background service you can just run: zkServer start ==> kafka To have launchd start kafka now and restart at login: brew services start kafka Or, if you don't want/need a background service you can just run: zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties & kafka-server-start /usr/local/etc/kafka/server.properties
啟動Zookeeper和Kafka
當前服務列表
➜~ brew services list NameStatusUserPlist kafkastopped mysqlstarted zhongmingmao /Users/zhongmingmao/Library/LaunchAgents/homebrew.mxcl.mysql.plist zookeeper stopped
啟動Zookeeper
➜~ brew services start zookeeper ==> Successfully started `zookeeper` (label: homebrew.mxcl.zookeeper)
啟動Kakfa
➜~ brew services start kafka ==> Successfully started `kafka` (label: homebrew.mxcl.kafka)
當前服務列表
➜~ brew services list NameStatusUserPlist kafkastarted zhongmingmao /Users/zhongmingmao/Library/LaunchAgents/homebrew.mxcl.kafka.plist mysqlstarted zhongmingmao /Users/zhongmingmao/Library/LaunchAgents/homebrew.mxcl.mysql.plist zookeeper started zhongmingmao /Users/zhongmingmao/Library/LaunchAgents/homebrew.mxcl.zookeeper.plist
基本測試
建立主題
➜~ kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic zhongmingmao Created topic "zhongmingmao". ➜~ kafka-topics --zookeeper localhost:2181 --list __consumer_offsets zhongmingmao ➜~ kafka-topics --zookeeper localhost:2181 --describe --topic zhongmingmao Topic:zhongmingmaoPartitionCount:1ReplicationFactor:1Configs: Topic: zhongmingmaoPartition: 0Leader: 0Replicas: 0Isr: 0
釋出訊息
➜~ kafka-console-producer --broker-list localhost:9092 --topic zhongmingmao >zhongmingmao >is >learning kafka >