原因已经查明
消费kafka的时候,如果使用topics_pattern的方式,默认partition_assignment_strategy为Range,应该使用
partition_assignment_strategy => "org.apache.kafka.clients.consumer.RoundRobinAssignor"
具体原因参见:The round-robin partition assignor lays out all the available partitions and all the available consumer threads. It then proceeds to do a round-robin assignment from partition to consumer thread. If the subscriptions of all consumer instances are identical, then the partitions will be uniformly distributed. (i.e., the partition ownership counts will be within a delta of exactly one across all consumer threads.) Round-robin assignment is permitted only if: (a) Every topic has the same number of streams within a consumer instance (b) The set of subscribed topics is identical for every consumer instance within the group.
Range partitioning works on a per-topic basis. For each topic, we lay out the avai