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中文網其他相關文章!