./bin/kafka-configs.sh --zookeeper zookeeper1:2181/kafka \
--alter --entity-type topics \
--entity-name test \
--add-config segment.ms=60000
./bin/kafka-configs.sh --zookeeper zookeeper1:2181/kafka \
--alter --entity-type topics \
--entity-name test \
--delete-config segment.ms
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--topic test --create \
--partitions 3 \
--replication-factor 3 \
--if-not-exists
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka --list
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka --topic test --describe
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka --topic test --delete
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--alter \
--topic test \
--partitions 7
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--describe \
--under-replicated-partitions
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--describe \
--unavailable-partitions
bin/kafka-console-producer.sh --broker-list kafka1:9092 --topic test
bin/kafka-console-producer.sh --broker-list kafka1:9092 --topic test --producer-property acks=all
bin/kafka-console-consumer.sh --bootstrap-server kafka1:9092 --topic test
bin/kafka-console-consumer.sh --bootstrap-server kafka1:9092 --topic test --from-beginning
bin/kafka-console-consumer.sh --bootstrap-server kafka1:9092 \
--topic streams-wordcount-output \
--from-beginning \
--formatter kafka.tools.DefaultMessageFormatter \
--property print.key=true \
--property print.value=true \
--property key.deserializer=org.apache.kafka.common.serialization.StringDeserializer \
--property value.deserializer=org.apache.kafka.common.serialization.LongDeserializer
bin/kafka-console-consumer.sh --bootstrap-server kafka1:9092 --topic test --group app1
bin/kafka-consumer-groups.sh --bootstrap-server kafka1:9092 --list
bin/kafka-consumer-groups.sh --bootstrap-server kafka1:9092 --describe --group appl1
bin/kafka-consumer-groups.sh --bootstrap-server kafka1:9092 --describe --group appl1 --members
bin/kafka-consumer-groups.sh --bootstrap-server kafka1:9092 --describe --group appl1 --state
- Create the json file to reassign partitions (
topics.json
)
{
"topics": [{ "topic": "test" }],
"version": 1
}
- Run the command through a dry-run
./bin/kafka-reassign-partitions.sh --zookeeper zookeeper1:2181/kafka --generate \
--topics-to-move-json-file topics.json \
--broker-list 3,2,1
-
<proposed-reassignment-json-from-the-output-of-the-above-command> > plan.json
-
Execute the reassignment
./bin/kafka-reassign-partitions.sh --zookeeper zookeeper1:2181/kafka --execute \
--reassignment-json-file plan.json
- Verify the reassignment completed
./bin/kafka-reassign-partitions.sh --zookeeper zookeeper1:2181/kafka --verify \
--reassignment-json-file plan.json
./bin/kafka-run-class.sh kafka.tools.DumpLogSegments --print-data-log \
--files <kafka-data-dir>/<partition-dir>/00000000000000000000.log
echo <zookeeper-server-id> > <zookeeper-data-dir>/myid
bin/zookeeper-shell.sh zookeeper1:2181/kafka
ls /