Reputation: 163
I want to change a default retention time of one topic to 'rentention.ms=100', but i don't find a solution in python. Can someone help me for this, pleaaaaase ?
Upvotes: 2
Views: 4005
Reputation: 532
You can use confluent-kafka-python alter_configs(), kafka-python client is currently broken for alter_configs()
from kafka.admin import KafkaAdminClient, ConfigResource
admin_client = KafkaAdminClient(
bootstrap_servers="localhost:9092",
client_id='test'
)
topic_list = []
topic_list.append(ConfigResource(restype='TOPIC', name='your_topic_name', set_config={"retention.ms":"1000"}, described_configs=None, error=None))
admin_client.alter_configs(resources=topic_list, validate_only=False)
Note: Any configuration properties that are not included will be reverted to their default values. The retention here is in milliseconds.
Upvotes: 7