deviceinsight / kafkactl

Command Line Tool for managing Apache Kafka
https://deviceinsight.github.io/kafkactl/
Apache License 2.0
822 stars 79 forks source link

Add replication factor into kafkactl get topics #105

Closed gurchenkov closed 2 years ago

gurchenkov commented 2 years ago

Hello, Its possible to add topic Replication Factor into kafkactl get topics output? Seems to be usefull. Thanks!

d-rk commented 2 years ago

Hey @gurchenkov , Replication Factor is a property of a partition. Theoretically, it can therefore differ in a topic.

Currently you can do one of the following:

# displays replicas for each partition of a single topic
kafkactl describe topic your-topic

# displays partitions of all topics incl. replication factor (yaml)
kafkactl get topics -o yaml

# displays partitions of all topics incl. replication factor (json)
kafkactl get topics -o json
gurchenkov commented 2 years ago

@random-dwi thank you for response!

kafka-topics displays replication factor by minimal replicas number among all partitions. Which is quite logical. And with this easily control the current number of replicas and overall topic availability without a deeper analysis configuration of each partition. And is there any reason to keep a different number of replicas for partitions of a single topic? Seems that this can lead to problems rather than give any profit. Please correct me if I'm wrong

d-rk commented 2 years ago

@gurchenkov we also do not have any usecases where using different replication factors for a single topic is used and I don't know about any. The structure how kafkactl displays it, is just derived from how it is represented in kafka. Displaying replicas as "minimal replicas among all partitions" in get topics command seems to be useful though. But I cannot say when we will have time to implement this. A PR for this would of course be great ;)

felix786 commented 2 years ago

@gurchenkov A replication factor of N allows you to control the topic reliability. Higher replication factor leads to higher availability. Assume topics had replication factor of three, meaning that each partition is replicated three times on three different brokers. If the topic is crucial we can create that topic with more replication factor.