Home >Java >javaTutorial >Learn to use common Kafka commands and flexibly respond to various scenarios.
bin/kafka-topics.sh --create --topic my-topic --partitions 3 --replication-factor 2
bin/kafka-topics.sh --list
bin/kafka-topics.sh --describe --topic my-topic
bin/kafka-console-producer.sh --topic my-topic --message "Hello, Kafka!"
bin/kafka-console-consumer.sh --topic my-topic --from-beginning
bin/kafka-topics.sh --alter --topic my-topic --partitions 5
bin/kafka-topics.sh --alter --topic my-topic --replication-factor 3
bin/kafka-topics.sh --delete --topic my-topic
bin/kafka-consumer-groups.sh --create --group my-group
bin/kafka-consumer-groups.sh --list
bin/kafka-consumer-groups.sh --describe --group my-group
bin/kafka-consumer-groups.sh --join --group my-group --topic my-topic
bin/kafka-consumer-groups.sh --leave --group my-group --topic my-topic
bin/kafka-consumer-groups.sh --delete --group my-group
bin/kafka-run-class kafka.tools.GetOffsetShell --topic my-topic --group my-group
bin/kafka-run-class kafka.tools.OffsetResetTool --topic my-topic --group my-group --to-earliest
bin/kafka-server-start.sh --daemon --console
bin/kafka-server-stop.sh
bin/kafka-run-class kafka.tools.JmxTool --query "kafka.server:type=*,name=*,clientId=*"
bin/kafka-run-class kafka.tools.DumpLogSegments --print-data --source /tmp/kafka-logs
bin/kafka-run-class kafka.tools.LoadLogSegments --source /tmp/kafka-logs
bin/kafka-upgrade-kafka.sh --target-version 3.0.0
bin/kafka-downgrade-kafka.sh --target-version 2.8.0
The above is the detailed content of Learn to use common Kafka commands and flexibly respond to various scenarios.. For more information, please follow other related articles on the PHP Chinese website!