How does kafka save the consumption location on the consumer side?
This article introduces the knowledge of "how to save the consumption location of the consumer side of kafka". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
In kafka, a built-in topic for _ _ consumer_ offsets_* is provided
_ _ consumer_offsets default partition 50
Create a consumer_offsets_group consumer group that ID will use later
Math.abs ("consumer_offsets_group" .hashCode ()) 50
As a result, it was put on section 11.
It can be obtained by the following formula:
View the consumer group offsets:
Bin/kafka-console-consumer.sh-topic _ consumer_offsets-partition 11-bootstrap-server localhost:9092-formatter "kafka.coordinator.group.GroupMetadataManager\ $OffsetsMessageFormatter"-consumer.config config/consumer.properties-from-beginning
Results:
[consumer_offsets_group/* consumer group ID*/,consumer_offsets_test/*topic*/,1/*partition*/]:: OffsetAndMetadata (consumption shift information submitted by offset=4/* * /, leaderEpoch=Optional.empty, metadata=, commitTimestamp=1543567461031, expireTimestamp=None)
[consumer_offsets_group,consumer_offsets_test,0]: OffsetAndMetadata (offset=3, leaderEpoch=Optional.empty, metadata=, commitTimestamp=1543567461031, expireTimestamp=None)
[consumer_offsets_group,consumer_offsets_test,2]: OffsetAndMetadata (offset=4, leaderEpoch=Optional.empty, metadata=, commitTimestamp=1543567461031, expireTimestamp=None)
[consumer_offsets_group,consumer_offsets_test,1]: OffsetAndMetadata (offset=4, leaderEpoch=Optional.empty, metadata=, commitTimestamp=1543567466027, expireTimestamp=None)
[consumer_offsets_group,consumer_offsets_test,0]: OffsetAndMetadata (offset=3, leaderEpoch=Optional.empty, metadata=, commitTimestamp=1543567466027, expireTimestamp=None)
[consumer_offsets_group,consumer_offsets_test,2]: OffsetAndMetadata (offset=4, leaderEpoch=Optional.empty, metadata=, commitTimestamp=1543567466027, expireTimestamp=None)
[consumer_offsets_group,consumer_offsets_test,1]: OffsetAndMetadata (offset=4, leaderEpoch=Optional.empty, metadata=, commitTimestamp=1543567468638, expireTimestamp=None)
[consumer_offsets_group,consumer_offsets_test,0]: OffsetAndMetadata (offset=3, leaderEpoch=Optional.empty, metadata=, commitTimestamp=1543567468638, expireTimestamp=None)
[consumer_offsets_group,consumer_offsets_test,2]: OffsetAndMetadata (offset=4, leaderEpoch=Optional.empty, metadata=, commitTimestamp=1543567468638, expireTimestamp=None)
This is the end of the content of "how to preserve the consumption location of the consumer side of kafka". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!