1 原因是: 多个相同的Spark Streaming同时消费同一个topic,导致的offset问题。关掉多余的任务,就ok了。
java.lang.IllegalStateException: No current assignment for partition mytopic-1 at org.apache.kafka.clients.consumer.internals.SubscriptionState.assignedState(SubscriptionState.java:251) at org.apache.kafka.clients.consumer.internals.SubscriptionState.seek(SubscriptionState.java:276) at org.apache.kafka....
二、offset is out of range 三、java.lang.IllegalStateException: No current assignment for partition djt_db.hehe.result-0 一、kafka_2.11-0.11.0.2版本中advertised.listeners参数导致的大坑: 场景:在我们自己的服务器上安装好单机kafka_2.11-0.11.0.2后,让另一家公司往我们的kafka的topic上推数,因为我们两...
topic: pet partition: 0 offset: 0 key: null value: topic: pet partition: 0 offset: 1 key: null value: gaoyu topic: pet partition: 0 offset: 2 key: null value: 66 1. 2. 3. 指定分区进行消费 消费 当然要有选择的权利,比如只想消费cat主题的0分区 def ConsumerTest(): Unit = { val p...
java.lang.IllegalStateException:No current assignment for partition my_dummy_topic-11 at org.apache.kafka.clients.consumer.internals.SubscriptionState.assignedState(SubscriptionState.java:251)at org.apache.kafka.clients.consumer.internals.SubscriptionState.needOffsetReset(SubscriptionState.java:315)at org.apa...
这里要注意的是,在seek前要使用subscribe()订阅topic或使用assign()分配topic的指定分区,否则就会出现 "java.lang.IllegalStateException: No current assignment for partition xxxxxx "的报错。另外由于subscribe()和assign()是“lazy”的,在seek前需要先"虚调用(dummy call)"poll()。对于subscribe()来说,下面的代...
Exception in thread "main" java.lang.IllegalStateException: No current assignment for partition secondTest-0 at org.apache.kafka.clients.consumer.internals.SubscriptionState.assignedState(SubscriptionState.java:269) at org.apache.kafka.clients.consumer.internals.SubscriptionState.seek(SubscriptionState.java:...
initializePartitionState(): 初始化已经存在的Partition的状态 for((topicPartition, replicaAssignment) <- controllerContext.partitionReplicaAssignment) { // check if leader and isr path exists for partition. If not, then it is in NEW state
public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) { List<PartitionInfo> partitions=cluster.partitionsForTopic(topic); int numPartitions=partitions.size();if(keyBytes==null) { ...
keySet()) assignment.put(memberId, new ArrayList<TopicPartition>()); //for循环对订阅的多个topic分别进行处理 for (Map.Entry<String, List<String>> topicEntry : consumersPerTopic.entrySet()) { String topic = topicEntry.getKey(); List<String> consumersForTopic = topicEntry.getValue(); Integer...