缺少必需的参数“[zookeeper]”

Missing required argument "[zookeeper]"

我正在尝试使用 Apache Kafka 启动一个消费者,它曾经运行良好,但我不得不格式化我的电脑并重新安装所有东西,现在在尝试 运行 时:

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

这是我得到的:

Missing required argument "[zookeeper]"
Option                                  Description                            
------                                  -----------                            
--blacklist <blacklist>                 Blacklist of topics to exclude from    
                                          consumption.                         
--bootstrap-server <server to connect                                          
  to>                                                                          
--consumer.config <config file>         Consumer config properties file.       
--csv-reporter-enabled                  If set, the CSV metrics reporter will  
                                          be enabled                           
--delete-consumer-offsets               If specified, the consumer path in     
                                          zookeeper is deleted when starting up
--formatter <class>                     The name of a class to use for         
                                          formatting kafka messages for        
                                          display. (default: kafka.tools.      
                                          DefaultMessageFormatter)             
--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.             
--key-deserializer <deserializer for                                           
  key>                                                                         
--max-messages <Integer: num_messages>  The maximum number of messages to      
                                          consume before exiting. If not set,  
                                          consumption is continual.            
--metrics-dir <metrics directory>       If csv-reporter-enable is set, and     
                                          this parameter isset, the csv        
                                          metrics will be outputed here        
--new-consumer                          Use the new consumer implementation.   
--property <prop>                                                              
--skip-message-on-error                 If there is an error when processing a 
                                          message, skip it instead of halt.    
--timeout-ms <Integer: timeout_ms>      If specified, exit if no message is    
                                          available for consumption for the    
                                          specified interval.                  
--topic <topic>                         The topic id to consume on.            
--value-deserializer <deserializer for                                         
  values>                                                                      
--whitelist <whitelist>                 Whitelist of topics to include for     
                                          consumption.                         
--zookeeper <urls>                      REQUIRED: The connection string for    
                                          the zookeeper connection in the form 
                                          host:port. Multiple URLS can be      
                                          given to allow fail-over.

我的猜测是 zookeeper 连接端口存在某种问题,因为它告诉我指定 zookeeper 连接到 kafka 必须使用的端口。不过,我不确定这一点,也不知道如何找出端口来指定这是否是问题所在。有什么建议吗??

在此先感谢您的帮助

看来您使用的是旧版本的 Kafka 工具,如果您想直接连接到代理,则需要设置 --new-consumer

我建议您选择最新版本的 Kafka,这样您只需指定 --bootstrap-server,就像您的示例中那样:http://kafka.apache.org/downloads