kafka-python
kafka-python copied to clipboard
How to dynamically adjust the number of partitions?
如何动态调整partition数量,是使用KafkaAdminClient.create_partitions方法么,有没有示例如何传值啊。。。一直没有成功
How to dynamically adjust the number of partitions? Do you use the KafkaAdminClient.create_partitions method? Are there any examples of how to pass values? . . Has never been successful
Currently requires a NewPartitions object instance. This should work:
from kafka.admin.new_partitions import NewPartitions
# Increase the partition count for 'foo_topic' to 6.
admin_client.create_partitions({'foo_topic': NewPartitions(total_count=6)})