赞
踩
[root@iZ2zedqr9yeos47fg4uor5Z kafka_2.12-2.8.0]# bin/kafka-console-producer.sh --broker-list 172.24.10.198:9092 --topic test
>a
>b
[root@iZ2zedqr9yeos47fg4uor5Z kafka_2.12-2.8.0]# bin/kafka-console-consumer.sh --bootstrap-server 172.24.10.198:9092 --topic test --from-beginning
a
b
[root@iZ2zedqr9yeos47fg4uor5Z kafka_2.12-2.8.0]# ./bin/kafka-consumer-groups.sh --bootstrap-server 172.24.10.198:9092 --list
test-consumer-group
[root@iZ2zedqr9yeos47fg4uor5Z kafka_2.12-2.8.0]# ./bin/kafka-consumer-groups.sh --bootstrap-server 172.24.10.198:9092 --describe --group test-consumer-group
Consumer group 'test-consumer-group' has no active members.
GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
test-consumer-group test 0 4611 4611 0 - - -
[root@iZ2zedqr9yeos47fg4uor5Z bin]# ./kafka-consumer-groups.sh --bootstrap-server 172.24.10.198:9092 --group test-consumer-group --reset-offsets --topic test2 --to-offset 100 --execute
GROUP TOPIC PARTITION NEW-OFFSET
test-consumer-group test2 0 100
--to-earliest: 设置到最早位移处,也就是0
--to-latest: 设置到最新处,也就是主题分区HW的位置
--to-offset NUM: 指定具体的位移位置
--shift-by NUM: 基于当前位移向前回退多少
--by-duration: 回退到多长时间
[root@iZ2zedqr9yeos47fg4uor5Z kafka_2.12-2.8.0]# bin/kafka-topics.sh --list --zookeeper localhost:2181
__consumer_offsets
test
zxf
[root@iZ2zedqr9yeos47fg4uor5Z bin]# ./kafka-topics.sh --delete --zookeeper 172.24.10.198:2181 --topic test
Topic test is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.
[root@iZ2zedqr9yeos47fg4uor5Z bin]# ./kafka-configs.sh --zookeeper localhost:2181 --entity-type topics --entity-name topic_name_xx --alter --add-config retention.ms=1296000000
Warning: --zookeeper is deprecated and will be removed in a future version of Kafka.
Use --bootstrap-server instead to specify a broker to connect to.
Completed updating config for entity: topic 'topic_name_xx'.
[root@iZ2zedqr9yeos47fg4uor5Z bin]# ./kafka-topics.sh --zookeeper localhost:2181 --topic topic_name_xx --describe
Topic: topic_name_xx TopicId: FntNDJn6QdS9XEiA8FDUIw PartitionCount: 1 ReplicationFactor: 1 Configs: retention.ms=1296000000
Topic: topic_name_xx Partition: 0 Leader: 0 Replicas: 0 Isr: 0
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。