Java 如何处理OffsetAutoFrangeException错误?
我正在使用Java 如何处理OffsetAutoFrangeException错误?,java,apache-kafka,apache-storm,Java,Apache Kafka,Apache Storm,我正在使用storm和kafka分析实时数据 我在spoot 错误 注: 喷口的起始时间为-1 风暴版本-0.9.0 卡夫卡·威瑞森-0.7.2 如何解决这个问题 任何建议都将不胜感激 kafka.common.OffsetOutOfRangeException 通常表示客户端请求的范围在服务器上不再可用 根据Kafka配置中的保留策略,主题日志中具有请求偏移量的消息不再存在时,可能会发生这种情况 下面是配置的示例:(查看它,并根据将其设置为最佳设置) 注意:Kafka将根据您的配置自动从文件中
storm
和kafka
分析实时数据
我在spoot
错误
注:
根据Kafka配置中的保留策略,主题日志中具有请求偏移量的消息不再存在时,可能会发生这种情况 下面是配置的示例:(查看它,并根据将其设置为最佳设置) 注意:Kafka将根据您的配置自动从文件中删除消息,并在zookeeper中保留分区偏移量。(考虑现在的偏移量是3000)。当Kafka完成清理时,该分区的偏移量被重置,以便最大偏移量必须小于zookeeper(3000)中存储的一个耗电元件。在这里,当消费者从zookeeper获得当前偏移量(即3000)并使用此偏移量从不存在的Kafka读取消息时,可能会出现问题。 因此,解决方案是将自动删除间隔处理到最佳值 查看下面的链接以了解更多信息
startoffsetime
。我正在使用我的自定义喷口,它将自动偏移。将重置为最小的或最大的。是否尝试将开始设置时间设置为-2?它将迫使喷口从头开始读取。此外,除非你有充分理由使用旧版本,否则你绝对应该尝试切换到卡夫卡0.8.*版本one@user2720864谢谢我试过startOffsetTime=-2
。它抛出了相同的错误。这可能是由于Kafka主题日志与使用者在zookeeper中维护的偏移量不匹配造成的。您是否可以清理zookeeper或使用新主题查看相同问题是否仍然存在?看看“班纽约”在讨论中的最后一句话,可能会给你一些启示
kafka.common.OffsetOutOfRangeException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at kafka.common.ErrorMapping$.maybeThrowException(ErrorMapping.scala:53)
at kafka.message.ByteBufferMessageSet.kafka$message$ByteBufferMessageSet$$internalIterator(ByteBufferMessageSet.scala:99)
at kafka.message.ByteBufferMessageSet.iterator(ByteBufferMessageSet.scala:82)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:73)
at kafka.message.MessageSet.foreach(MessageSet.scala:87)
at scala.collection.TraversableOnce$class.size(TraversableOnce.scala:104)
at kafka.message.MessageSet.size(MessageSet.scala:87)
at storm.kafka.PartitionManager.fill(PartitionManager.java:113)
at storm.kafka.PartitionManager.next(PartitionManager.java:83)
at storm.kafka.KafkaSpout.nextTuple(KafkaSpout.java:106)
at backtype.storm.daemon.executor$fn__3430$fn__3445$fn__3474.invoke(executor.clj:547)
at backtype.storm.util$async_loop$fn__444.invoke(util.clj:403)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:745)
############################# Log Retention Policy #############################
# The following configurations control the disposal of log segments. The policy can
# be set to delete segments after a period of time, or after a given size has accumulated.
# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
# from the end of the log.
# The minimum age of a log file to be eligible for deletion
log.retention.hours=168
# A size-based retention policy for logs. Segments are pruned from the log as long as the remaining
# segments don't drop below log.retention.bytes.
#log.retention.bytes=1073741824
# The maximum size of a log segment file. When this size is reached a new log segment will be created.
log.segment.bytes=536870912
# The interval at which log segments are checked to see if they can be deleted according
# to the retention policies
log.cleanup.interval.mins=1