User Tools

Site Tools


kafka

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
kafka [2026/05/19 14:25] reddykafka [2026/05/19 14:29] (current) reddy
Line 121: Line 121:
 </code> </code>
  
 +===== Kafka CLI =====
 +
 +<code>
 +# List topics
 +./bin/kafka-topics.sh --bootstrap-server=a.xyz:9092,b.xyz:9092,c.xyz:9092 --list
 +
 +# Create a topic for testing
 +./bin/kafka-topics.sh --bootstrap-server=a.xyz:9092,b.xyz:9092,c.xyz:9092 --create --topic topic1 --partitions 1 --replication-factor 3 --config retention.ms=-1 --config retention.bytes=524288000 --config max.message.bytes=30000000 --config flush.messages=1
 +
 +# List topics
 +./bin/kafka-topics.sh --bootstrap-server=a.xyz:9092,b.xyz:9092,c.xyz:9092 --list
 +
 +# See details for the topic
 +./bin/kafka-topics.sh --bootstrap-server=a.xyz:9092,b.xyz:9092,c.xyz:9092 --describe --topic topic1
 +
 +# To change the replication factor for a topic, use the "kafka-reassign-partitions" utility
 +cat > partcfg.json <<EOF
 +{"version":1,
 +  "partitions":[
 +     {"topic":"topic1","partition":0,"replicas":[1,2,3]},
 +     {"topic":"topic1","partition":1,"replicas":[1,2,3]},
 +     {"topic":"topic1","partition":2,"replicas":[1,2,3]}
 +]}
 +EOF
 +kafka-reassign-partitions --bootstrap-server=a.xyz:9092,b.xyz:9092,c.xyz:9092 --reassignment-json-file partcfg.json --execute
 +
 +# To change any other config for an existing topic
 +# ./bin/kafka-configs.sh --bootstrap-server <host:port> --entity-type topics --entity-name <topic-name> --alter --add-config retention.ms=-1,retention.bytes=524288000
 +#
 +
 +# See more at: https://kafka.apache.org/documentation/#topicconfigs
 +</code>
kafka.1779193554.txt.gz · Last modified: by reddy

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki