When you are starting your Kafka broker you can define set of properties in conf/server.properties
file. This file is just key value property file. One of the properties is auto.create.topics.enable
, if it’s set to true (by default) Kafka will create topics automatically when you send messages to non-existing topics.
All config options you can find are defined here. IMHO, a simple rule for creating topics is the following: number of replicas cannot be more than the number of nodes that you have. Number of topics and partitions is unaffected by the number of nodes in your cluster
for example:
- You have 9 node cluster
- Your topic can have 9 partitions and 9 replicas or
18 partitions and 9 replicas or
36 partitions and 9 replicas and so on…