我正在尝试使用Apache Kafka启动用户,它曾经运行良好,但是我必须格式化我的PC并再次重新安装所有内容,现在尝试运行此程序:
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所必须使用的端口。不过我不确定,也不知道如何找出端口来指定这是否是问题所在。有什么建议吗?
预先感谢您的帮助
答案 0 :(得分:2)
您似乎正在使用旧版本的Kafka工具,如果要直接连接到代理,则需要设置--new-consumer
。
我建议您选择最新版本的Kafka,因此您只需像示例中那样指定--bootstrap-server
:http://kafka.apache.org/downloads