Option Description------ -------------all-groups Apply to all consumer groups.--all-topics Consider all topics assigned to agroup in the `reset-offsets` process.--bootstrap-server <String: server to REQUIRED: The server(s) to connect to.connect to>--by-duration <String: duration> Reset offsets to offset by durationfrom current timestamp. Format:'PnDTnHnMnS'--command-config <String: command Property file containing configs to beconfig property file> passed to Admin Client and Consumer.--delete Pass in groups to delete topicpartition offsets and ownershipinformation over the entire consumergroup. For instance --group g1 --group g2--delete-offsets Delete offsets of consumer group.Supports one consumer group at thetime, and multiple topics.--describe Describe consumer group and listoffset lag (number of messages notyet processed) related to givengroup.--dry-run Only show results without executingchanges on Consumer Groups.Supported operations: reset-offsets.--execute Execute operation. Supportedoperations: reset-offsets.--export Export operation execution to a CSVfile. Supported operations: reset-offsets.--from-file <String: path to CSV file> Reset offsets to values defined in CSVfile.--group <String: consumer group> The consumer group we wish to act on.--help Print usage information.--list List all consumer groups.--members Describe members of the group. Thisoption may be used with '--describe'and '--bootstrap-server' optionsonly.Example: --bootstrap-server localhost:9092 --describe --group group1 --members--offsets Describe the group and list all topicpartitions in the group along withtheir offset lag. This is thedefault sub-action of and may beused with '--describe' and '--bootstrap-server' options only.Example: --bootstrap-server localhost:9092 --describe --group group1 --offsets--reset-offsets Reset offsets of consumer group.Supports one consumer group at thetime, and instances should beinactiveHas 2 execution options: --dry-run(the default) to plan which offsetsto reset, and --execute to updatethe offsets. Additionally, the --export option is used to export theresults to a CSV format.You must choose one of the followingreset specifications: --to-datetime,--by-period, --to-earliest, --to-latest, --shift-by, --from-file, --to-current.To define the scope use --all-topicsor --topic. One scope must bespecified unless you use '--from-file'.--shift-by <Long: number-of-offsets> Reset offsets shifting current offsetby 'n', where 'n' can be positive ornegative.--state [String] When specified with '--describe',includes the state of the group.Example: --bootstrap-server localhost:9092 --describe --group group1 --stateWhen specified with '--list', itdisplays the state of all groups. Itcan also be used to list groups withspecific states.Example: --bootstrap-server localhost:9092 --list --state stable,emptyThis option may be used with '--describe', '--list' and '--bootstrap-server' options only.--timeout <Long: timeout (ms)> The timeout that can be set for someuse cases. For example, it can beused when describing the group tospecify the maximum amount of timein milliseconds to wait before thegroup stabilizes (when the group isjust created, or is going throughsome changes). (default: 5000)--to-current Reset offsets to current offset.--to-datetime <String: datetime> Reset offsets to offset from datetime.Format: 'YYYY-MM-DDTHH:mm:SS.sss'--to-earliest Reset offsets to earliest offset.--to-latest Reset offsets to latest offset.--to-offset <Long: offset> Reset offsets to a specific offset.--topic <String: topic> The topic whose consumer groupinformation should be deleted ortopic whose should be included inthe reset offset process. In `reset-offsets` case, partitions can bespecified using this format: `topic1:0,1,2`, where 0,1,2 are thepartition to be included in theprocess. Reset-offsets also supportsmultiple topic inputs.--verbose Provide additional information, ifany, when describing the group. Thisoption may be used with '--offsets'/'--members'/'--state' and'--bootstrap-server' options only.Example: --bootstrap-server localhost:9092 --describe --group group1 --members --verbose--version Display Kafka version.
[root@localhost bin]# ./kafka-consumer-groups.sh --bootstrap-server 192.168.217.130:9092 --describe --all-groupsGROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-IDtest2-group-2 test1 0 0 0 0 consumer-test2-group-2-1-b65f86b5-a032-41bd-9159-9f961ed7ea17 /192.168.217.1 consumer-test2-group-2-1
LAG 值越小越好。
