from kafka import KafkaConsumer, TopicPartition consumer = KafkaConsumer('eip_rec_behave', group_id='test11', # 一个组消费一次 auto_offset_reset='latest', # 从最新数据读取,earliest,latest bootstrap_servers=['eip-kafka-2.qa.mlamp.cn'] ) for msg in consumer: print(msg.value)