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

[KAFKA]kafka常用操作

时间:2019-01-10 12:07:23      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:xxx   replica   consumer   begin   partition   示例   帮助   OLE   star   

-- kafka路径示例
/opt/cloudera/parcels/KAFKA/bin
-- kafka启动
./kafka-server-start.sh -daemon ../config/server.properties
-- 帮助信息
kafka-topics --help
-- 查看topic
kafka-topics --list -zookeeper hadoop02:9092,hadoop03:9092,hadoop04:9092 --topic MQ_TN_BIG_DATA_CALL_API_MSG_XXX_XXX

-- 查看topc结构
kafka-topics --describe -zookeeper hadoop02:9092,hadoop03:9092,hadoop04:9092 --topic MQ_TN_BIG_DATA_CALL_API_MSG_XXX_XXX

-- 创建topic 2个分区,2个副本
bin/kafka-topics.sh --create --zookeeper hadoop02:9092,hadoop03:9092,hadoop04:9092 --replication-factor 2 --partitions 2 --topic test

-- 生产消息
kafka-console-producer.sh --broker-list hadoop02:9092,hadoop03:9092,hadoop04:9092 --topic MQ_TN_BIG_DATA_CALL_API_MSG_XXX_XXX


-- 消费消息
kafka-console-consumer.sh -zookeeper hadoop02:9092,hadoop03:9092,hadoop04:9092 --from-beginning --topic MQ_TN_BIG_DATA_CALL_API_MSG_XXX_XXX

-- 为topic增加partition.
kafka-topics.sh –zookeeper hadoop02:9092,hadoop03:9092,hadoop04:9092 –alter –partitions 3 –topic MQ_TN_BIG_DATA_CALL_API_MSG_XXX_XXX

[KAFKA]kafka常用操作

标签:xxx   replica   consumer   begin   partition   示例   帮助   OLE   star   

原文地址:https://www.cnblogs.com/amberly/p/10249063.html

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