立即注册 登录
About云-梭伦科技 返回首页

muyannian的个人空间 https://www.aboutyun.com/?440 [收藏] [复制] [分享] [RSS]

日志

Kafka0.8命令介绍

已有 769 次阅读2014-10-11 19:41

启动zookeeper

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

启动kafka server

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

创建topic

bin/kafka-create-topic.sh --zookeeper localhost:2181 --replica 1 --partition 1 --topic test

list

bin/kafka-list-topic.sh --zookeeper localhost:2181

producer

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

comsumer

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

多个brocker 整目录拷贝多份就可以了

cp config/server.properties config/server-1.properties cp config/server.properties config/server-1.properties

新的配置

config/server-1.properties: broker.id=1 port=9093 log.dir=/tmp/kafka-logs-1 config/server-2.properties: broker.id=2 port=9094 log.dir=/tmp/kafka-logs-2

启动

JMX_PORT=9997 bin/kafka-server-start.sh config/server-1.properties & JMX_PORT=9998 bin/kafka-server-start.sh config/server-2.properties &

创建topic

bin/kafka-create-topic.sh --zookeeper localhost:2181 --replica 3 --partition 1 --topic my-replicated-topic

list

bin/kafka-list-topic.sh --zookeeper localhost:2181

publish

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic my-replicated-topic

comsumer

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --from-beginning --topic my-replicated-topic pkill -9 -f server-1.properties

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

关闭

推荐上一条 /2 下一条