Originally developed as a part of https://github.com/klarna/brod
make
For Kafka 3.3 or later:
docker compose -f docker-compose-kraft.yml up -dFor earlier versions:
docker compose up -dSet TOPICS environment variable to have them created.
TOPICS='topic-1:1,topic-2:2' docker compose up -dcreate_topic() {
TOPIC_NAME="$1"
PARTITIONS="${2:-1}"
REPLICAS="${3:-1}"
CMD="kafka-topics.sh --zookeeper localhost --create --partitions $PARTITIONS --replication-factor $REPLICAS --topic $TOPIC_NAME"
docker exec kafka-1 bash -c "$CMD"
}
create_topic "test-topic"
docker exec kafka-1 kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'SCRAM-SHA-256=[iterations=8192,password=ecila]' --entity-type users --entity-name alice
docker exec kafka-1 kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'SCRAM-SHA-512=[password=ecila]' --entity-type users --entity-name alice