A consumption offset indicates the consumption progress of a consumer. This section describes how to view and reset consumption offsets.
Messages may be retrieved more than once after the offset is reset. Exercise caution when performing this operation.
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).
Select the region where your Kafka instance is located.
./kafka-consumer-groups.sh --bootstrap-server ${connection-address} --offsets --describe --all-groups
Parameter description: connection-address indicates the Kafka instance address, which can be obtained in the Connection area on the Basic Information page on the Kafka console.
Example:
[root@ecs-kafka bin]# ./kafka-consumer-groups.sh --bootstrap-server 192.168.xx.xx:9092,192.168.xx.xx:9092,192.168.xx.xx:9092 --offsets --describe --all-groups Consumer group '__consumer-group-dial-test' has no active members. GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID __consumer-group-dial-test __dms_dial_test 0 350 350 0 - - - __consumer-group-dial-test __dms_dial_test 1 350 350 0 - - - __consumer-group-dial-test __dms_dial_test 2 350 350 0 - - - Consumer group 'test' has no active members. GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID test topic-01 0 5 5 0 - - - test topic-01 1 3 3 0 - - - test topic-01 2 10 10 0 - - - [root@ecs-kafka bin]#
security.protocol=SASL_PLAINTEXT # If the SASL mechanism is SCRAM-SHA-512, configure as follows: sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \ username="**********" \ password="**********"; sasl.mechanism=SCRAM-SHA-512 # If the SASL mechanism is PLAIN, configure as follows: sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \ username="**********" \ password="**********"; sasl.mechanism=PLAIN
Parameter description: username and password are the ones you set when enabling ciphertext access for the first time or when creating a user.
security.protocol=SASL_SSL ssl.truststore.location={ssl_truststore_path} ssl.truststore.password=dms@kafka ssl.endpoint.identification.algorithm= # If the SASL mechanism is SCRAM-SHA-512, configure as follows: sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \ username="**********" \ password="**********"; sasl.mechanism=SCRAM-SHA-512 # If the SASL mechanism is PLAIN, configure as follows: sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \ username="**********" \ password="**********"; sasl.mechanism=PLAIN
Parameter description:
./kafka-consumer-groups.sh --bootstrap-server ${connection-address} --offsets --describe --all-groups --command-config ../config/ssl-user-config.properties
Parameter description: connection-address indicates the Kafka instance address, which can be obtained in the Connection area on the Basic Information page on the Kafka console.
Example:
[root@ecs-kafka bin]# ./kafka-consumer-groups.sh --bootstrap-server 192.168.xx.xx:9093,192.168.xx.xx:9093,192.168.xx.xx:9093 --offsets --describe --all-groups --command-config ../config/ssl-user-config.properties Consumer group '__consumer-group-dial-test' has no active members. GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID __consumer-group-dial-test __dms_dial_test 0 347 347 0 - - - __consumer-group-dial-test __dms_dial_test 1 347 347 0 - - - __consumer-group-dial-test __dms_dial_test 2 347 347 0 - - - Consumer group 'test' has no active members. GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID test topic-01 0 5 5 0 - - - test topic-01 1 3 3 0 - - - test topic-01 2 10 10 0 - - - [root@ecs-kafka bin]#
Select the region where your Kafka instance is located.
Parameter |
Description |
---|---|
Reset By |
You can reset an offset by:
If you reset offsets in batches, they can only be reset to the specified time. |
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.
|
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. |