1.查看所有topic 列表
./kafka-topics.sh --zookeeper 192.168.1.160:2181 --list
./kafka-topics.sh -list -zookeeper 192.168.1.160:2181,192.168.1.161:2181,192.168.1.162:2181
2.查看topic某分区偏移量最大(小)值
./kafka-run-class.sh kafka.tools.GetOffsetShell --topic testoffset1 --time -1 --broker-list 192.168.1.160:9092 --partitions 1
4.查看日志
./kafka-log-dirs.sh --bootstrap-server 192.168.1.160:9092 --describe --topic-list sunqi
5.查看 consumer group 列表
./kafka-consumer-groups.sh --bootstrap-server 192.168.1.160:9092 --list
6.查看 指定group
./kafka-consumer-groups.sh --bootstrap-server 192.168.1.160:9092 --group 0 --describe
./kafka-consumer-groups.sh --bootstrap-server 192.168.1.160:9092 --describe --group ucp165
4、创建消费者
./kafka-console-consumer.sh --zookeeper 192.168.1.160:2181 --topic sunqi
–from-beginning 每次都是从开始位置消费,在生产环境下不建议这样使用。
5、查看指定topic
./kafka-topics.sh --describe --zookeeper 192.168.1.160:2181 --topic testoffset1
9.topic 扩容
./bin/kafka-topics.sh --zookeeper 192.168.1.160:2181 --alter --partitions 3 --topic testoffset1
org.apache.kafka.clients.consumer.CommitFailedException: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing max.poll.interval.ms or by reducing the maximum size of batches returned in poll() with max.poll.records.