本文介绍了我在哪里定义 topic.metadata.refresh.interval.ms?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对 kafka 进行一些测试,希望很快将其放入我的生产堆栈中.
我正在使用文件 kafka-console-producer.shkafka-console-consumer.sh 来测试 kafka 的功能.

I'm testing kafka a little, and hopefully am going to put it in my production stack soon.
I'm using the files kafka-console-producer.sh and kafka-console-consumer.sh to test kafka's functionality.

我创建了一个包含 2 个分区的主题,但我看到我的生产者发送的所有消息都将发送到一个分区.

I created a topic with 2 partitions, but I see that all the messages my producer is sending are going to one partition.

我在互联网上搜索了这个并读到有一个名为 topic.metadata.refresh.interval.ms 的设置,它告诉生产者更改它当前正在写入的分区,并且默认设置是 10 分钟.

I searched this on the internet and read that there is a setting called topic.metadata.refresh.interval.ms that tells the producer to change the partition it's currently writing to, and that the default is 10 min.

我正在尝试更改此设置,但我不明白在哪里...?

I'm trying to change this setting, but I don't understand where... ?

推荐答案

Kafka属性可以在以下三个文件中找到

Kafka properties can be found in the following three files

server.properties、producer.properties、consumer.properties

这些文件将在文件夹 kafka-folder/config/ 中可用.默认情况下,这些文件中将提供一些属性.您可以添加任何您想要的属性.此链接中给出了属性列表https://kafka.apache.org/08/configuration.html.此链接包含服务器、生产者和消费者的所有属性的详细说明.

These files will be available in the folder kafka-folder/config/. By default some properties will be available in those file. You can add what ever the properties you want. The list of properties is given in this link https://kafka.apache.org/08/configuration.html. This link contains detail explanation of all the properties for server, producer and consumer.

由于topic.metadata.refresh.interval.ms是生产者配置,所以需要在producer.properties 文件

注意上面的链接是kafka-0.8版本的属性配置.

Note the above link is the property configurations for the kafka-0.8 version.

这篇关于我在哪里定义 topic.metadata.refresh.interval.ms?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 19:54