resetting the offset group kafka

Use Kafka comes kafka-consumer-groups.sh scripts are free to set consumer group (consumer group), which is a new feature version 0.11.0.0, provided you set are: consumer group state is inactive, that is not in a state of being at work.
Reset displacement by the following process steps consisting of 3:
1, to determine the displacement reset Strategies - rules currently supports eight settings:
--to-Earliest: displacement adjusting to the minimum displacement current partition
--to-latest: the displacement adjusting the partition is currently the latest displacement
--to-current: current partition to the displacement of the displacement adjusting
--to-offset <offset>: the displacement of the displacement adjusting to the specified
--shift-by N: the displacement of the displacement adjusting to the current at the + N , Note that N may be negative indicating forward movement
--to-datetime <datetime>: to be greater than the displacement of the first displacement at a given time, datetime format-ddTHH the mM-YYYY: mm: ss.xxx
- by -duration <duration>: displacement adjusting to the displacement at the specified interval from the current time, duration format PnDTnHnMnS
--from-file <file>: reading adjustment policy from a CSV file
2, determines to perform the program - currently supports 3 kinds of programs:
What parameters do not add: just print out the displacement adjustment programs, no specific implementation
--execute: the implementation of a real displacement adjustment
--export: the displacement adjustment programs printed in CSV format, user-friendly to csv file for subsequent direct use
3, it is determined topic Scope - Scope currently has three targeting methods: - all-topics (all partitions for all the topic of the displacement adjustment consumer group), - topic t1 --topic t2 ( for the specified number of adjusting the displacement topic all partitions), - topic t1: 0,1,2 (adjusted for the specified topic partition displacement)
the following example is provided on how to reset displacement:
. 1 .---Earliest to: partition the displacement are reset It is set to 0

bogon:kafka_0.11 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group test-group --reset-offsets --all-topics --to-earliest --execute


2 .-- to-latest: the displacement of all partitions are reset to the latest displacement, that is, 1,000,000

bogon:kafka_0.11 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group test-group --reset-offsets --all-topics --to-latest --execute


3 .-- to-offset <offset>: displacement of all the partitions are adjusted for a given 500,000

bogon:kafka_0.11 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group test-group --reset-offsets --all-topics --to-offset 500000 --execute


4 .-- to-current: the displacement of all partitions have been moved to the current displacement, displacement unchanged from the previous step

bogon:kafka_0.11 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group test-group --reset-offsets --all-topics --to-current --execute


5 .-- shift-by N: the displacement of all partitions is moved to (500000--100000) = 400,000 at

bogon:kafka_0.11 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group test-group --reset-offsets --all-topics --shift-by -100000 --execute


6 .-- to-datetime: displacement adjusting all partitions of the first shift after at 3:30 on the March 2019 3

bogon:kafka_0.11 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group test-group --reset-offsets --all-topics --to-datetime 2019-03-03T3:30:00.000


7 .-- by-duration: all partitions displacement is adjusted to 30 minutes before the first displacement

bogon:kafka_0.11 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group test-group --reset-offsets --all-topics --by-duration PT0H30M0S


Transfer from  https://bugjia.net/200118/100.html

Guess you like

Origin www.cnblogs.com/8765h/p/12233576.html