Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Latest commit

 

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Kattlo Examples

  1. Install Kattlo
  2. Create the kafka.properties file
  3. Run the examples
    • make sure your current folder is examples

Topics

  • Migration with human readable values
kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/10_human_readable'
  • Create a topic
kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/01_create_with_config'
  • Create a topic and patch the number of partitions
kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/02_create_patch_partitions'
  • Create a topic and patch to increase the replication factor

you need a cluster with two or more brokers to run the following example

kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/03_create_patch_replication_factor'
  • Create a topic and patch to reduce the replication factor

you need a cluster with two or more brokers to run the following example

kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/04_create_patch_reduce_replication_factor'
  • Create a topic and remove it
kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/05_create_and_remove'
  • Create a topic and patch config to cluster default
kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/06_create_patch_config_to_default'
  • Create a topic and patch to add new config
kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/07_create_patch_add_new_config'
  • Many topics migrations in the same directory

Do not use this approach, otherwise your migration management will become a mess

kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/08_many_topics_same_dir'
  • Patch just the config
kattlo \
  --config-file='.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/09_patch_config'

Rules Enforcement

kattlo \
  --config-file='topic/rules/human/.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/rules/01_incorrect_topic_name'
  • Topic name follows de rule
kattlo \
  --config-file='topic/rules/human/.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/rules/02_correct_topic_name'
  • Topic config does not follow the rules
kattlo \
  --config-file='topic/rules/human/.kattlo.yaml' \
  --kafka-config-file='kafka.properties' \
  topic \
  --directory='topic/rules/03_incorrect_config'

# The output will be:

 Topic Rule Violation:

  - partitions: expected '>=3', but was '2'
  - replicationFactor: expected '==2', but was '3'
  - compression.type: expected 'in [lz4, snappy]', but was 'gzip'
  - min.cleanable.dirty.ratio: expected '>=1%', but was '0.001'
  - max.message.bytes: expected '<=900KiB', but was '1048576'