docker compose -f ./docker-compose-kraft.yml down
rm -rf ./kafka-data/*
docker compose -f ./docker-compose-kraft.yml up -d


docker compose -f ./docker-compose-kraft.yml up -d --force-recreate
docker logs -f kafka-apache-kraft-410

docker exec -it kafka-apache-kraft-410 /bin/bash

cd /opt/kafka/bin/
/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --topic test-topic --partitions 1 --replication-factor 1
cat /opt/kafka/config/server.properties
cat /opt/kafka/config/log4j2.yaml


./kafka-topics.sh --bootstrap-server localhost:9092 --list
./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group test-consumer-group

./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test-topic --from-beginning --max-messages 1

./kafka-consumer-groups.sh \
  --bootstrap-server localhost:9092 \
  --group temp-offset-checker-$(date +%s) \
  --describe \
  --all-topics

./kafka-consumer-groups.sh \
  --bootstrap-server localhost:9092 \
  --group temp-offset-checker \
  --describe \
  --all-topics

./kafka-console-consumer.sh \
  --bootstrap-server localhost:9092 \
  --topic test-topic \
  --from-beginning \
  --max-messages 1 \
  --group test-manual-group-001

# --time -2 表示获取 Latest Offset (最大 Offset)
./kafka-run-class.sh kafka.tools.GetOffsetShell \
  --broker-list localhost:9092 \
  --topic test-topic \
  --time -2

./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group go-sarama-consumer-group-v1

# 消费量
./kafka-log-dirs.sh \
  --bootstrap-server localhost:9092 --describe --topic-list test-topic

./kafka-console-consumer.sh \
    --bootstrap-server localhost:9092 \
    --topic test-topic
    --consumer-property auto.offset.reset=latest

./kafka-console-producer.sh \
    --bootstrap-server localhost:9092 \
    --topic test-topic