1. Option Description
    2. ------ -----------
    3. --all-groups Apply to all consumer groups.
    4. --all-topics Consider all topics assigned to a
    5. group in the `reset-offsets` process.
    6. --bootstrap-server <String: server to REQUIRED: The server(s) to connect to.
    7. connect to>
    8. --by-duration <String: duration> Reset offsets to offset by duration
    9. from current timestamp. Format:
    10. 'PnDTnHnMnS'
    11. --command-config <String: command Property file containing configs to be
    12. config property file> passed to Admin Client and Consumer.
    13. --delete Pass in groups to delete topic
    14. partition offsets and ownership
    15. information over the entire consumer
    16. group. For instance --group g1 --
    17. group g2
    18. --delete-offsets Delete offsets of consumer group.
    19. Supports one consumer group at the
    20. time, and multiple topics.
    21. --describe Describe consumer group and list
    22. offset lag (number of messages not
    23. yet processed) related to given
    24. group.
    25. --dry-run Only show results without executing
    26. changes on Consumer Groups.
    27. Supported operations: reset-offsets.
    28. --execute Execute operation. Supported
    29. operations: reset-offsets.
    30. --export Export operation execution to a CSV
    31. file. Supported operations: reset-
    32. offsets.
    33. --from-file <String: path to CSV file> Reset offsets to values defined in CSV
    34. file.
    35. --group <String: consumer group> The consumer group we wish to act on.
    36. --help Print usage information.
    37. --list List all consumer groups.
    38. --members Describe members of the group. This
    39. option may be used with '--describe'
    40. and '--bootstrap-server' options
    41. only.
    42. Example: --bootstrap-server localhost:
    43. 9092 --describe --group group1 --
    44. members
    45. --offsets Describe the group and list all topic
    46. partitions in the group along with
    47. their offset lag. This is the
    48. default sub-action of and may be
    49. used with '--describe' and '--
    50. bootstrap-server' options only.
    51. Example: --bootstrap-server localhost:
    52. 9092 --describe --group group1 --
    53. offsets
    54. --reset-offsets Reset offsets of consumer group.
    55. Supports one consumer group at the
    56. time, and instances should be
    57. inactive
    58. Has 2 execution options: --dry-run
    59. (the default) to plan which offsets
    60. to reset, and --execute to update
    61. the offsets. Additionally, the --
    62. export option is used to export the
    63. results to a CSV format.
    64. You must choose one of the following
    65. reset specifications: --to-datetime,
    66. --by-period, --to-earliest, --to-
    67. latest, --shift-by, --from-file, --
    68. to-current.
    69. To define the scope use --all-topics
    70. or --topic. One scope must be
    71. specified unless you use '--from-
    72. file'.
    73. --shift-by <Long: number-of-offsets> Reset offsets shifting current offset
    74. by 'n', where 'n' can be positive or
    75. negative.
    76. --state [String] When specified with '--describe',
    77. includes the state of the group.
    78. Example: --bootstrap-server localhost:
    79. 9092 --describe --group group1 --
    80. state
    81. When specified with '--list', it
    82. displays the state of all groups. It
    83. can also be used to list groups with
    84. specific states.
    85. Example: --bootstrap-server localhost:
    86. 9092 --list --state stable,empty
    87. This option may be used with '--
    88. describe', '--list' and '--bootstrap-
    89. server' options only.
    90. --timeout <Long: timeout (ms)> The timeout that can be set for some
    91. use cases. For example, it can be
    92. used when describing the group to
    93. specify the maximum amount of time
    94. in milliseconds to wait before the
    95. group stabilizes (when the group is
    96. just created, or is going through
    97. some changes). (default: 5000)
    98. --to-current Reset offsets to current offset.
    99. --to-datetime <String: datetime> Reset offsets to offset from datetime.
    100. Format: 'YYYY-MM-DDTHH:mm:SS.sss'
    101. --to-earliest Reset offsets to earliest offset.
    102. --to-latest Reset offsets to latest offset.
    103. --to-offset <Long: offset> Reset offsets to a specific offset.
    104. --topic <String: topic> The topic whose consumer group
    105. information should be deleted or
    106. topic whose should be included in
    107. the reset offset process. In `reset-
    108. offsets` case, partitions can be
    109. specified using this format: `topic1:
    110. 0,1,2`, where 0,1,2 are the
    111. partition to be included in the
    112. process. Reset-offsets also supports
    113. multiple topic inputs.
    114. --verbose Provide additional information, if
    115. any, when describing the group. This
    116. option may be used with '--
    117. offsets'/'--members'/'--state' and
    118. '--bootstrap-server' options only.
    119. Example: --bootstrap-server localhost:
    120. 9092 --describe --group group1 --
    121. members --verbose
    122. --version Display Kafka version.
    1. [root@localhost bin]# ./kafka-consumer-groups.sh --bootstrap-server 192.168.217.130:9092 --describe --all-groups
    2. GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
    3. test2-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 值越小越好。