Topic Repartitioning Plugin
The topic-repartitioning
plugin is used to repartition a topic.
This plugin is useful when:
- you want to change the partitioning scheme of a topic from one scheme to another.
- you want to increase or decrease the number of partitions in a topic.
Synopsys
Configuring the partitioning scheme
The topic-repartitioning
plugin supports the following partitioning schemes:
- Automatic
- Hash-based partitioning
- Random partitioning
- Round-robin based partitioning
Automatic repartitioning
In this mode, Armory will simply strip the original partition and offset information from the record and it will therefore delegate the partitioning strategy to the event broker.
Hash-based partitioning
This is the default partitioning scheme in Kafka. A hash of the key (or a header’s value) is used to determine the partition.
The following algorithms are currently supported:
- murmur2
- fnv1a
- crc32
When a key is present in the message, the key is used to determine the partition. If the key is not present, Armory will fall-back to the automatic scheme. An empty key is considered to be present, therefore all messages with an empty key will be assigned the same partition.
The algorithm
field is optional and defaults to murmur2
.
The partition is calculated as follows:
A header’s value can also used instead of the key:
Random partitioning
Messages are distributed to partitions randomly.
Round-robin based partitioning
Messages are distributed to partitions in a round-robin fashion. This is useful when you want to distribute messages evenly across partitions.