The consumer configuration parameters kafka

bootstrap.servers

broker cluster address in the form: ip1: port, ip2: port ..., no need to set all of the cluster address, you can set up two or more.

group.id

Consumer group name consumer belongs, if it is empty will be reported exceptions, in general, this parameter to have a certain business sense.

fetch.min.bytes

The smallest amount of data from the parameter used to configure the Consumer Kafka pulls pulling in a request (call to poll () method), the default value 1 (B). Upon receipt of Kafka pulling Consumer request, if the amount of data returned to the Consumer value smaller than this configuration parameter, then it is required to wait until the amount of data to meet the size of the configuration parameters. This may be appropriate to transfer large values ​​of the parameters to improve certain throughput, but also cause additional delay (latency), for delay-sensitive applications it may be desirable up.

fetch.max.bytes

This parameter corresponds fetch.min.bytes parameter, which is used in a pull configuration Consumer maximum amount of data fetch request from the pull Kafka, the default value 52428800 (B), i.e. 50MB.

If the value of the parameter settings Kafka in a message is written than any smaller, it will not cause the consumer not it? Not an absolute maximum value of the parameter set, the first message if the first non-empty partition pull is greater than this value, then the message will still return, in order to ensure that consumers continue to work. Kafka's maximum message size that can be received by the end of the service parameters message.max.bytes (corresponding to parameters relating to the end max.message.bytes) set.

fetch.max.wait.ms

This parameter also fetch.min.bytes and parameters, and if Kafka only reference fetch.min.bytes parameters of the requirements, then there may have been blocked and can not wait to send a response to the Consumer, it is clearly unreasonable. Latency fetch.max.wait.ms Kafka parameter specifies a default value of 500 (ms). If Kafka is not enough and can not meet the requirements fetch.min.bytes message parameters, then the final will wait 500ms. This delay between the set and the Consumer and Kafka also related parameters, if latency-sensitive business applications, you can turn down the appropriate parameters.

max.partition.fetch.bytes

This parameter is used to set the maximum amount of data returned to the Consumer from each partition, the default value is 1048576 (B), i.e., 1MB. This parameter fetch.max.bytes similar parameters, but the former for limiting a pull message size for each partition, and the latter is used to limit the size of a pull the entire message. Similarly, if the value of this parameter is set to be smaller than the size of the message, it will not cause the consumer not, Kafka consumption in order to maintain the normal operation of this logic does not make tough restrictions.

max.poll.records

This parameter is used to configure the maximum number of messages in Consumer pulling a pull request, the default value is 500 (bars). If the size of the message are relatively small, you can turn up the appropriate parameter values ​​to improve certain rate of consumption.

connections.max.idle.ms

This parameter is used to specify how long after the closing inactive connection, the default value is 540000 (ms), i.e. 9 minutes.

exclude.internal.topics

There are two themes in Kafka internal: __consumer_offsets and __transaction_state. exclude.internal.topics used to specify whether the internal topic Kafka can be open to consumers, the default value is true. If set to true, you can only use the subscribe (Collection) way not to subscribe to the interior theme uses subscribe (Pattern) way, is set to false is not the limit.

receive.buffer.bytes

This parameter is used to set the size of the received message buffer Socket (SO_RECBUF), the default value is 65536 (B), i.e., 64KB. If set to -1, the operating system default values ​​are used. If the Consumer Kafka in a different room, can be adjusted appropriately large value of this parameter.

send.buffer.bytes

This parameter is used to set the size of the send message buffer Socket (the SO_SNDBUF), the default value is 131072 (B), i.e. 128KB. Like receive.buffer.bytes parameter, if set to -1, then the operating system default value.

request.timeout.ms

This parameter is used to configure the Consumer request response waiting the longest time, the default value is 30000 (ms).

metadata.max.age.ms

This parameter is used to configure the expiration time of the metadata, the default value is 300000 (ms), i.e., five minutes. If the metadata defined parameters within this time window is not updated, the update will be forced, or even without any change in new partitions broker added

reconnect.backoff.ms

This parameter is used to attempt to configure the waiting time before reconnecting the specified host (also referred to as back-off time), to avoid frequent connection to the host, the default value is 50 (ms). This mechanism applies to all consumer requests sent to the broker.

auto.offset.reset

Parameter is a string type, valid values ​​are "earliest" "latest" "none", the remaining value is configured to report the abnormal

enable.auto.commit

boolean type, enable automatic configuration is submitted consumption displacement, enabled by default

auto.commit.interval.ms

When enbale.auto.commit parameter is set to take effect if true, indicates the automatic turn-on time of submission of the consumption displacement of consumer shift function automatically submit interval

partition.assignment.strategy

Consumers partition allocation policy

interceptor.class

用来配置消费者客户端的拦截器
Published 107 original articles · won praise 29 · views 180 000 +

Guess you like

Origin blog.csdn.net/zhangyingchengqi/article/details/104813780