如何将参数传递给kafka-console-consumer

时间:2017-06-06 09:27:16

标签: apache-kafka

我正在尝试通过运行命令使用kafka-console-consumer读取大小为3mb的消息:

/bin/kafka-console-consumer --zookeeper myzookeeper:2181 --topic Topic1

但是,我得到例外:

2017-06-05 17:16:13,046] ERROR Error processing message, terminating consumer process:  (kafka.tools.ConsoleConsumer$)
kafka.common.MessageSizeTooLargeException: Found a message larger than the maximum fetch size of this consumer on topic Topic1 partition 9 at fetch offset 5. Increase the fetch size, or decrease the maximum message size the broker will allow.
    at kafka.consumer.ConsumerIterator.makeNext(ConsumerIterator.scala:90)
    at kafka.consumer.ConsumerIterator.makeNext(ConsumerIterator.scala:33)
    at kafka.utils.IteratorTemplate.maybeComputeNext(IteratorTemplate.scala:64)
    at kafka.utils.IteratorTemplate.hasNext(IteratorTemplate.scala:56)
    at kafka.consumer.OldConsumer.receive(BaseConsumer.scala:89)
    at kafka.tools.ConsoleConsumer$.process(ConsoleConsumer.scala:110)
    at kafka.tools.ConsoleConsumer$.run(ConsoleConsumer.scala:70)
    at kafka.tools.ConsoleConsumer$.main(ConsoleConsumer.scala:48)
    at kafka.tools.ConsoleConsumer.main(ConsoleConsumer.scala)
Processed a total of 0 messages

现在我正在尝试运行命令:

/bin/kafka-console-consumer --zookeeper myzookeeper:2181 --topic Topic1 --args max.partitiion.fetch.bytes=10485760

但是得到错误:

args is not a recognized option

如何将参数args传递给kafka-console-consumer?

1 个答案:

答案 0 :(得分:1)

尝试在文件中指定使用者属性,并为其提供--consumer.config参数。