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
以上是学会使用Kafka常用命令,灵活应对各种场景的学习必备的详细内容。更多信息请关注PHP中文网其他相关文章!