码迷,mamicode.com
首页 > 其他好文 > 详细

kafka 笔记

时间:2017-11-03 15:27:30      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:begin   over   send   console   buffer   zookeeper   启动服务   bootstrap   zook   

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 笔记

标签:begin   over   send   console   buffer   zookeeper   启动服务   bootstrap   zook   

原文地址:http://www.cnblogs.com/fubinhnust/p/7777983.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!