Which command shifts offsets by 2 positions backward for a consumer group on a topic?

Study for the Apache Kafka CCDAK Test. Use flashcards and multiple choice questions, with hints and explanations for each answer. Prepare effectively for your certification!

Multiple Choice

Which command shifts offsets by 2 positions backward for a consumer group on a topic?

Explanation:
Shifting offsets backward by a fixed amount is done with the reset-offsets command using a negative value for the shift parameter. The --shift-by option moves the committed offset by the given number of positions for each partition of the topic. A negative value means moving to earlier messages, so offsets are reduced by that amount and the consumer group will reprocess earlier data. In this case, to move backward by 2 positions, you would use --shift-by -2, applied with --group, --topic, and the other required flags, for example: bin/kafka-consumer-groups --bootstrap-server localhost:9092 --group my-first-consumer-group --reset-offsets --topic my-first_topic --shift-by -2 --execute. Using a positive shift (like --shift-by 2) would move forward by two messages, not backward. Using --to-earliest would reset to the earliest available offsets, and --to-latest would jump to the latest offsets, neither of which corresponds to shifting by a fixed backward amount.

Shifting offsets backward by a fixed amount is done with the reset-offsets command using a negative value for the shift parameter. The --shift-by option moves the committed offset by the given number of positions for each partition of the topic. A negative value means moving to earlier messages, so offsets are reduced by that amount and the consumer group will reprocess earlier data.

In this case, to move backward by 2 positions, you would use --shift-by -2, applied with --group, --topic, and the other required flags, for example: bin/kafka-consumer-groups --bootstrap-server localhost:9092 --group my-first-consumer-group --reset-offsets --topic my-first_topic --shift-by -2 --execute.

Using a positive shift (like --shift-by 2) would move forward by two messages, not backward. Using --to-earliest would reset to the earliest available offsets, and --to-latest would jump to the latest offsets, neither of which corresponds to shifting by a fixed backward amount.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy