lanying56123 发表于 2018-8-19 10:21:20

Kafka-2.11学习笔记(二)Shell脚本介绍

# 消息生产者  
$ bin/kafka-console-producer.sh
  
Read data from standard input and publish it to Kafka. # 从控制台读取数据
  
Option                           Description
  
------                           -----------
  
--topic                     REQUIRED: The broker list string in the form HOST1:PORT1,HOST2:PORT2.
  
--broker-list         REQUIRED: The topic id to produce messages to.
  
    # 这两个为必选参数,其他的可选参数可以通过直接执行该命令查看帮助
  

  
# 消息消费者
  
$ bin/kafka-console-consumer.sh
  
The console consumer is a tool that reads data from Kafka and outputs it to standard output.
  
Option                           Description
  
------                           -----------
  
--zookeeper                  REQUIRED: The connection string for the zookeeper connection,
  
                                 in the form host:port.(Multiple URLS can be given to allow fail-over.)
  
--topic                     The topic id to consume on.
  
--from-beginning                   If the consumer does not already have an established offset to
  
                                 consume from, start with the earliest message present in the
  
                                 log rather than the latest message.
  
    # zookeeper参数是必须的,其他的都是可选的,具体的参考帮助信息
  

  
# 查看消息信息
  
$ bin/kafka-topics.sh
  
Create, delete, describe, or change a topic.
  
Option                           Description
  
------                           -----------
  
--zookeeper                  REQUIRED: The connection string for the zookeeper connection,
  
                                 in the form host:port. (Multiple URLS can be given to allow fail-over.)
  
--create                           Create a new topic.
  
--delete                           Delete a topic
  
--alter                            Alter the configuration for the topic.
  
--list                           List all available topics.
  
--describe                         List details for the given topics.
  
--topic                     The topic to be create, alter or describe. Can also accept
  
                                 a regular expression except for --create option。
  
--help                           Print usage information.
  
    # zookeeper参数是必须的,其他的都是可选的,具体的参考帮助信息


页: [1]
查看完整版本: Kafka-2.11学习笔记(二)Shell脚本介绍