kafka 笔记
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kafka 笔记相关的知识,希望对你有一定的参考价值。
Quick Start
1.下载代码
> tar -xzf kafka_2.11-1.0.0.tgz
> cd kafka_2.11-1.0.0
2.启动服务
(1) 单个zookeeper节点
> bin/zookeeper-server-start.sh config/zookeeper.properties
[2013-04-22 15:01:37,495] INFO Reading configuration from: config/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
...
(2) kafka服务
> bin/kafka-server-start.sh config/server.properties
[2013-04-22 15:01:47,028] INFO Verifying properties (kafka.utils.VerifiableProperties)
[2013-04-22 15:01:47,051] INFO Property socket.send.buffer.bytes is overridden to 1048576 (kafka.utils.VerifiableProperties)
...
3.创建主题
(1)单个分区一个主题副本
> bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
(2)查看主题
> bin/kafka-topics.sh --list --zookeeper localhost:2181
test
4.发送一些消息
启动生产者,推送一些数据到kafka server
> bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
This is a message
This is another message
5.启动一个消费者
> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
This is a message
This is another message
以上是关于kafka 笔记的主要内容,如果未能解决你的问题,请参考以下文章