You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
4.4 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

[Kafka快速入门Kafka消费者-腾讯云开发者社区-腾讯云](https://cloud.tencent.com/developer/article/2218267)
| 参数名称 | 说明 |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| bootstrap.servers | 向Kafka集群建立初始连接用到的host/port列表 |
| key.deserializer和value.deserializer | 指定接收消息的key和value的反序列化类型。一定要写全类名 |
| group.id | 标记消费者所属的消费者组 |
| enable.auto.commit | 默认值为true消费者会自动周期性地向服务器提交偏移量 |
| auto.commit.interval.ms | 如果设置了 enable.auto.commit 的值为true 则该值定义了消费者偏移量向Kafka提交的频率默认5s |
| auto.offset.reset | 当Kafka中没有初始偏移量或当前偏移量在服务器中不存在数据被删除了该如何处理earliest自动重置偏移量到最早的偏移量。latest默认自动重置偏移量为最新的偏移量。none如果消费组原来的previous偏移量不存在则向消费者抛异常。anything向消费者抛异常 |
| offsets.topic.num.partitions | __consumer_offsets 的分区数,默认是 50 个分区 |
| heartbeat.interval.ms | Kafka 消费者和 coordinator 之间的心跳时间,默认 3s。该条目的值必须小于 session.timeout.ms 也不应该高于session.timeout.ms的 1/3 |
| session.timeout.ms | Kafka 消费者和 coordinator 之间连接超时时间,默认 45s。超过该值该消费者被移除消费者组执行再平衡 |
| max.poll.interval.ms | 消费者处理消息的最大时长,默认是 5 分钟。超过该值,该消费者被移除,消费者组执行再平衡 |
| fetch.min.bytes | 默认 1 个字节。消费者获取服务器端一批消息最小的字节数 |
| fetch.max.wait.ms | 默认 500ms。如果没有从服务器端获取到一批数据的最小字节数。该时间到仍然会返回数据 |
| fetch.max.bytes | 默认Default:5242880050m。消费者获取服务器端一批消息最大的字节数。如果服务器端一批次的数据大于该值50m仍然可以拉取回来这批数据因此这不是一个绝对最大值。一批次的大小受 message.max.bytes broker configormax.message.bytestopicconfig影响 |
| max.poll.records | 一次 poll 拉取数据返回消息的最大条数,默认是 500 条 |