官网里有参数的解释https://kafka-python.readthed... 主要是这句话:“ If no heartbeats are received by the broker before the expiration of this session timeout, then the broker will remove this consumer from the group and initiate a rebalance.” 另外本机的session_timeout_ms默认值我的是30s,不是官网里说的10s!
https://stackoverflow.com/que... 最下面的回答,注意conf中session.timeout.ms参数的设置。
几分钟不应该啊,能把代码贴下么
ok
session.timeout.ms设置的太大了,导致了这个原因,感谢回答!
你在实例化consumer对象的时候加这样两个参数session_timeout_ms=6000,heartbeat_interval_ms=2000
consumer = KafkaConsumer(self.kafkatopic, group_id = self.groupid, bootstrap_servers = '{kafka_host}:{kafka_port}'.format( kafka_host=self.kafkaHost, kafka_port=self.kafkaPort ), session_timeout_ms=6000, heartbeat_interval_ms=2000)
官网里有参数的解释https://kafka-python.readthed...
主要是这句话:“ If no heartbeats are received by the broker before the expiration of this session timeout, then the broker will remove this consumer from the group and initiate a rebalance.”
另外本机的session_timeout_ms默认值我的是30s,不是官网里说的10s!
更改了参数还是会出现这样的问题