Ninja Docs Help

Useful commands

Revision

Date

Description

1.0

24.07.2024

Init Changelog

List topics

./kafka-topics.sh --bootstrap-server MACHINES --command-config /opt/kafka_2.12-3.0.0/config/client.properties --list

Where:

  • MACHINES - list of machines in Kafka Cluster

Create new topic

./kafka-topics.sh --bootstrap-server MACHINES --command-config /opt/kafka_2.12-3.0.0/config/client.properties --create --topic TOPIC PARAMETERS

Where:

  • MACHINES - list of machines in Kafka Cluster

  • TOPIC - name of topic to create

  • PARAMETERS - all parameters to attach to topic, like:

    • --replication-factor 3

    • --partitions 4

    • --config cleanup.policy=compact

    • --config min.insync.replicas=2

    • --config message.timestamp.type=CreateTime

Create ACL

./kafka-acls.sh --bootstrap-server MACHINES --command-config /opt/kafka_2.12-3.0.0/config/client.properties --add --allow-principal User:USERNAME --operation SCOPE --topic TOPIC

Where:

  • MACHINES - list of machines in Kafka Cluster

  • USERNAME - username

  • SCOPE - scope to add into ACL

  • TOPIC - name of topic

Create ACL for group

./kafka-acls.sh --bootstrap-server MACHINES --command-config /opt/kafka_2.12-3.0.0/config/client.properties --add --allow-principal User:USERNAME --operation SCOPE --group GROUP

Where:

  • MACHINES - list of machines in Kafka Cluster

  • USERNAME - username

  • SCOPE - scope to add into ACL

  • GROUP - nameof group

Delete all ACLs for topic

./kafka-acls.sh --bootstrap-server MACHINES --command-config /opt/kafka_2.12-3.0.0/config/client.properties --remove --topic TOPIC

Where:

  • MACHINES - list of machines in Kafka Cluster

  • TOPIC - name of topic

Delete ACL for topic and user

./kafka-acls.sh --bootstrap-server MACHINES --command-config /opt/kafka_2.12-3.0.0/config/client.properties --remove --allow-principal User:USERNAME --operation SCOPE --topic TOPIC

Where:

  • MACHINES - list of machines in Kafka Cluster

  • USERNAME - username

  • SCOPE - scope to add into ACL

  • TOPIC - name of topic

Edit topic partition

./kafka-topics.sh --bootstrap-server MACHINES --command-config /opt/kafka_2.12-3.0.0/config/client.properties --alter --topic TOPIC --partitions PARTITION_NUMBER

Where:

  • MACHINES - list of machines in Kafka Cluster

  • TOPIC - name of topic

  • PARTITION_NUMBER - number of partition

Add user

./kafka-configs.sh --bootstrap-server MACHINES --alter --add-config 'SCRAM-SHA-512=[password=PASSWORD]' --command-config /opt/kafka_2.12-3.0.0/config/client.properties --entity-type users --entity-name USERNAME

Where:

  • MACHINES - list of machines in Kafka Cluster

  • PASSWORD - password for user (with 8 symbols)

  • USERNAME - name for user

Delete user

./kafka-configs.sh --bootstrap-server MACHINES --alter --remove-config 'SCRAM-SHA-512' --command-config /opt/kafka_2.12-3.0.0/config/client.properties --entity-type users --entity-name USERNAME

Where:

  • MACHINES - list of machines in Kafka Cluster

  • USERNAME - name for user

Last modified: 17 February 2025