Updated on 2024-04-07 GMT+08:00

Resetting the Consumer Offset

Resetting the consumer offset is to change the retrieval position of a consumer.

Messages may be retrieved more than once after the offset is reset. Exercise caution when performing this operation.

Prerequisites

The consumer offset cannot be reset on the fly. You must first stop retrieval of the desired consumer group.

After a client is stopped, the server considers the client offline only after the time period specified in ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG (1000 ms by default).

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner to select a region.

    Select the region where your Kafka instance is located.

  3. Click and choose Application > Distributed Message Service for Kafka to open the console of DMS for Kafka.
  4. Click the desired Kafka instance to view the instance details.
  5. In the navigation pane, choose the Consumer Groups tab.
  6. Click the name of the desired consumer group.
  7. On the Consumer Offset tab page, you can perform the following operations:

    • To reset the consumer offset of all partitions of a single topic, click Reset Consumer Offset in the row containing the desired topic.
    • To reset the consumer offset of a single partition of a single topic, click Reset Consumer Offset in the row containing the desired partition.

  8. In the displayed Reset Consumer Offset dialog box, set the parameters by referring to Table 1.

    Table 1 Parameters for resetting the consumer offset

    Parameter

    Description

    Reset By

    You can reset an offset by:

    • Time: Reset the offset to the specified time.
    • Offset: Reset the offset to the specified position.

    Time

    Set this parameter if Reset By is set to Time.

    Select a time point. After the reset is complete, retrieval starts from this time point.

    • Earliest: earliest offset
    • Custom: a custom time point
    • Latest: latest offset

    Offset

    Set this parameter if Reset By is set to Offset.

    Enter an offset, which is greater than or equal to 0. After the reset is complete, retrieval starts from this offset.

  9. Click OK.
  10. Click Yes in the confirmation dialog box. The consumer offset is reset.