Kafka总结(三)配置参数说明


1. Broker 相关配置

quota.window.size.seconds
Name Description
zookeeper.connect zookeeper集群的地址,逗号分割
advertised.host.name 已弃用:仅在未设置“advertised.listeners”或“ listeners”时,使用`advertised.listeners`代替。
发布到ZooKeeper的主机名,供客户端使用。 在IaaS环境中,这可能需要与代理绑定的接口不同。 如果未设置,它将使用“ host.name”的值(如果已配置)。 否则,它将使用从java.net.InetAddress.getCanonicalHostName()返回的值。默认:null
advertised.listeners 如果listeners与上面的listeners不同,则发布到ZooKeeper以便客户端使用的listeners。 在IaaS环境中,这可能需要与代理绑定的接口不同。 如果未设置,将使用“ listeners”的值。默认:null
advertised.port 已弃用:仅在未设置“ advertised.listeners”或“ listeners”时使用。 使用`advertised.listeners`。
发布到ZooKeeper的端口,供客户端使用。 在IaaS环境中,这可能需要与代理绑定的端口不同。 如果未设置,它将发布代理绑定到的相同端口。默认:null
auto.create.topics.enable 是否允许自动创建topic,若是false,就需要通过命令创建topic。默认:true
auto.leader.rebalance.enable 启用Leader自动平衡。 后台线程定期检查并触发领导者平衡。默认:true
background.threads 用于各种后台处理任务的线程数。默认:10
broker.id 每一个broker在集群中的唯一表示,要求是正数。当该服务器的IP地址发生改变时,broker.id没有变化,则不会影响consumers的消息情况。默认:-1
compression.type 默认情况下消息是不压缩的,这个参数可以指定使用消息压缩,参数可以取值为snappy、gzip或者lz4,默认不压缩。
**snappy**:压缩算法由Google研发,这种算法在性能和压缩比取得比较好的平衡;
**gzip**:消耗更多的CPU资源,但是压缩效果也是最好的。通过使用压缩,我们可以节省网络带宽和Kafka存储成本。默认:producer
delete.topic.enable 启用删除主题。 如果关闭此配置,则通过管理工具删除主题将无效。默认:false
host.name 已弃用:仅在未设置"listener”时使用。 改用`listeners`。
broker的主机名。 如果设置此选项,它将仅绑定到该地址。 如果未设置,它将绑定到所有接口。默认:""
leader.imbalance.check.interval.seconds controller触发分区重新平衡检查的频率。默认:300
leader.imbalance.per.broker.percentage 每个broker允许leader失衡比率,如果超过这个值将触发leader balance,该值以百分比指定。默认:10
listeners listener列表
如:PLAINTEXT://myhost:9092,TRACE://:9091
PLAINTEXT://0.0.0.0:9092,TRACE:// localhost:9093。默认:null
log.dir 保留日志数据的目录(log.dirs属性的补充)。多个目录使用逗号分割,如果你有多块磁盘,建议配置成多个目录,从而达到I/O的效率的提升。默认:/tmp/kafka-logs
log.dirs 保留日志数据的目录。 如果未设置,则使用log.dir中的值。默认:null
log.flush.interval.messages 将消息刷新到磁盘之前,在日志分区上累积的消息数。默认:9223372036854775807
log.flush.interval.ms 刷新到磁盘之前,任何主题中的消息在内存中保留的最长时间(以毫秒为单位)。 如果未设置,则使用log.flush.scheduler.interval.ms中的值。默认:null
log.flush.offset.checkpoint.interval.ms 我们更新上次刷新的持久记录的频率,该持久刷新充当日志恢复点。默认:60000
log.flush.scheduler.interval.ms 日志刷新程序检查是否需要将任何日志刷新到磁盘的频率(毫秒)。默认:9223372036854775807
log.retention.bytes 删除日志前的最大日志大小。默认:-1
log.retention.hours 日志保存时间 (hours 或 minutes),默认为7天(168小时)。超过这个时间会根据policy处理数据。bytes和minutes无论哪个先达到都会触发。默认:168
log.retention.minutes The number of minutes to keep a log file before deleting it (in minutes), secondary to log.retention.ms property. If not set, the value in log.retention.hours is used。默认:null
log.retention.ms The number of milliseconds to keep a log file before deleting it (in milliseconds), If not set, the value in log.retention.minutes is used。默认:null
log.roll.hours 新建一个segment时间间隔。默认:168
log.roll.jitter.hours The maximum jitter to subtract from logRollTimeMillis (in hours), secondary to log.roll.jitter.ms property。默认:0
log.roll.jitter.ms The maximum jitter to subtract from logRollTimeMillis (in milliseconds). If not set, the value in log.roll.jitter.hours is used。默认:null
log.roll.ms The maximum time before a new log segment is rolled out (in milliseconds). If not set, the value in log.roll.hours is used。默认:null
log.segment.bytes 控制日志segment文件的大小,超出该大小则追加到一个新的日志segment文件中(-1表示没有限制)。默认:1073741824,1G
log.segment.delete.delay.ms The amount of time to wait before deleting a file from the filesystem。默认:60000
message.max.bytes 服务器接受单个消息的最大大小,即消息体的最大大小,单位是字节。默认:1000012,约1M
min.insync.replicas When a producer sets acks to "all" (or "-1"), min.insync.replicas specifies the minimum number of replicas that must acknowledge a write for the write to be considered successful. If this minimum cannot be met, then the producer will raise an exception (either NotEnoughReplicas or NotEnoughReplicasAfterAppend).
When used together, min.insync.replicas and acks allow you to enforce greater durability guarantees. A typical scenario would be to create a topic with a replication factor of 3, set min.insync.replicas to 2, and produce with acks of "all". This will ensure that the producer raises an exception if a majority of replicas do not receive a write。默认:1
num.io.threads 处理磁盘I/O的线程数。默认:8
num.network.threads 处理网络请求的最大线程数。默认:3
num.recovery.threads.per.data.dir 在启动时恢复日志和关闭时刷盘日志时每个数据目录的线程的数量。默认:1
num.replica.fetchers follower中开启的fetcher线程数, 同步速度与系统负载均衡。默认:1
offset.metadata.max.bytes The maximum size for a metadata entry associated with an offset commit。默认:4096
offsets.commit.required.acks The required acks before the commit can be accepted. In general, the default (-1) should not be overridden。默认:-1
offsets.commit.timeout.ms Offset commit will be delayed until all replicas for the offsets topic receive the commit or this timeout is reached. This is similar to the producer request timeout。默认:5000
offsets.load.buffer.size Batch size for reading from the offsets segments when loading offsets into the cache。默认:5242880
offsets.retention.check.interval.ms Frequency at which to check for stale offsets。默认:600000
offsets.retention.minutes Log retention window in minutes for offsets topic。默认:1440
offsets.topic.compression.codec Compression codec for the offsets topic - compression may be used to achieve "atomic" commits。默认:168
offsets.topic.num.partitions The number of partitions for the offset commit topic (should not change after deployment)。默认:50
offsets.topic.replication.factor offset topic 的副本数量(设置更高以确保可用性),如果集群大小不满足此复制因子需求,内部topic创建将失败。默认:3
offsets.topic.segment.bytes The offsets topic segment bytes should be kept relatively small in order to facilitate faster log compaction and cache loads。默认:104857600,100M
port DEPRECATED: only used when `listeners` is not set. Use `listeners` instead. the port to listen and accept connections on。默认:9092
queued.max.requests I/O线程等待队列中的最大的请求数,超过这个数量,network线程就不会再接收一个新的请求。应该是一种自我保护机制。默认:500
quota.consumer.default DEPRECATED: Used only when dynamic default quotas are not configured for or in Zookeeper. Any consumer distinguished by clientId/consumer group will get throttled if it fetches more bytes than this value per-second。默认:9223372036854775807
quota.producer.default DEPRECATED: Used only when dynamic default quotas are not configured for , or in Zookeeper. Any producer distinguished by clientId will get throttled if it produces more bytes than this value per-second。默认:9223372036854775807
replica.fetch.min.bytes fetch的最小数据尺寸。默认:1
replica.fetch.wait.max.ms max wait time for each fetcher request issued by follower replicas. This value should always be less than the replica.lag.time.max.ms at all times to prevent frequent shrinking of ISR for low throughput topics。默认:500
replica.high.watermark.checkpoint.interval.ms The frequency with which the high watermark is saved out to disk。默认:5000
replica.lag.time.max.ms If a follower hasn't sent any fetch requests or hasn't consumed up to the leaders log end offset for at least this time, the leader will remove the follower from isr。默认:10000
replica.socket.receive.buffer.bytes The socket receive buffer for network requests。默认:65536
replica.socket.timeout.ms The socket timeout for network requests. Its value should be at least replica.fetch.wait.max.ms。默认:30000
request.timeout.ms timeout.ms则指定broker在返回结果前等待其他副本(与acks参数相关)响应的时间,如果时间到了但其他副本没有响应结果,则返回消息写入失败。默认:30000
socket.receive.buffer.bytes The SO_RCVBUF buffer of the socket sever sockets. If the value is -1, the OS default will be used。默认:102400
socket.request.max.bytes Socket服务器将接受的请求的最大大小(对OOM的保护)。默认:104857600,100M
socket.send.buffer.bytes Socket服务器使用的发送缓冲区(SO_SNDBUF)。默认:102400
unclean.leader.election.enable Indicates whether to enable replicas not in the ISR set to be elected as leader as a last resort, even though doing so may result in data loss。默认:true
zookeeper.connection.timeout.ms The max time that the client waits to establish a connection to zookeeper. If not set, the value in zookeeper.session.timeout.ms is used。默认:null
zookeeper.session.timeout.ms Zookeeper session timeout。默认:6000
zookeeper.set.acl Set client to use secure ACLs。默认:false
broker.id.generation.enable Enable automatic broker id generation on the server. When enabled the value configured for reserved.broker.max.id should be reviewed。默认:true
broker.rack Rack of the broker. This will be used in rack aware replication assignment for fault tolerance. Examples: `RACK1`, `us-east-1d`。默认:null
connections.max.idle.ms Idle connections timeout: the server socket processor threads close the connections that idle more than this。默认:600000
controlled.shutdown.enable Enable controlled shutdown of the server。默认:true
controlled.shutdown.max.retries Controlled shutdown can fail for multiple reasons. This determines the number of retries when such failure happens。默认:3
controlled.shutdown.retry.backoff.ms Before each retry, the system needs time to recover from the state that caused the previous failure (Controller fail over, replica lag etc). This config determines the amount of time to wait before retrying。默认:5000
controller.socket.timeout.ms partition leader与replicas之间通讯时,socket的超时时间。默认:30000
default.replication.factor 创建topic时默认副本数。默认:1
fetch.purgatory.purge.interval.requests The purge interval (in number of requests) of the fetch request purgatory。默认:1000
group.max.session.timeout.ms The maximum allowed session timeout for registered consumers. Longer timeouts give consumers more time to process messages in between heartbeats at the cost of a longer time to detect failures。默认:300000
group.min.session.timeout.ms The minimum allowed session timeout for registered consumers. Shorter timeouts result in quicker failure detection at the cost of more frequent consumer heartbeating, which can overwhelm broker resources。默认:6000
inter.broker.protocol.version 指定将使用哪个版本的broker间协议。
通常在将所有代理升级到新版本后会发生冲突。
一些有效值的示例为:0.8.0、0.8.1, 0.8.1.1、0.8.2、0.8.2.0、0.8.2.1、0.9.0.0、0.9.0.1检查ApiVersion的完整列表。默认:0.10.1-IV2
log.cleaner.backoff.ms The amount of time to sleep when there are no logs to clean。默认:15000
log.cleaner.dedupe.buffer.size The total memory used for log deduplication across all cleaner threads。默认:134217728
log.cleaner.delete.retention.ms How long are delete records retained?。默认:86400000
log.cleaner.enable Enable the log cleaner process to run on the server? Should be enabled if using any topics with a cleanup.policy=compact including the internal offsets topic. If disabled those topics will not be compacted and continually grow in size。默认:true
log.cleaner.io.buffer.load.factor Log cleaner dedupe buffer load factor. The percentage full the dedupe buffer can become. A higher value will allow more log to be cleaned at once but will lead to more hash collisions。默认:0.9
log.cleaner.io.buffer.size The total memory used for log cleaner I/O buffers across all cleaner threads。默认:524288
log.cleaner.io.max.bytes.per.second The log cleaner will be throttled so that the sum of its read and write i/o will be less than this value on average。默认:1.7976931348623157E308
log.cleaner.min.cleanable.ratio The minimum ratio of dirty log to total log for a log to eligible for cleaning。默认:0.5
log.cleaner.min.compaction.lag.ms The minimum time a message will remain uncompacted in the log. Only applicable for logs that are being compacted。默认:168
log.cleaner.threads 日志压缩运行的线程数。默认:1
log.cleanup.policy 日志清理策略选择有:delete和compact主要针对过期数据的处理,或是日志文件达到限制的额度,会被topic创建时的指定参数覆盖。默认:delete
log.index.interval.bytes The interval with which we add an entry to the offset index。默认:4096
log.index.size.max.bytes The maximum size in bytes of the offset index。默认:10485760,10M
log.message.format.version 指定broker将用于将消息添加到日志文件的消息格式版本。 该值应该是有效的ApiVersion。 一些例子是:0.8.2,0.9.0.0,0.10.0。 通过设置特定的消息格式版本,用户保证磁盘上的所有现有消息都小于或等于指定的版本。 不正确地设置这个值将导致使用旧版本的用户出错,因为他们将接收到他们不理解的格式的消息。默认:0.10.1-IV2
log.message.timestamp.difference.max.ms The maximum difference allowed between the timestamp when a broker receives a message and the timestamp specified in the message. If log.message.timestamp.type=CreateTime, a message will be rejected if the difference in timestamp exceeds this threshold. This configuration is ignored if log.message.timestamp.type=LogAppendTime。默认:9223372036854775807
log.message.timestamp.type Define whether the timestamp in the message is message create time or log append time. The value should be either `CreateTime` or `LogAppendTime`。默认:CreateTime
log.preallocate Should pre allocate file when create new segment? If you are using Kafka on Windows, you probably need to set it to true。默认:false
log.retention.check.interval.ms 日志片段文件的检查周期,查看它们是否达到了删除策略的设置(log.retention.hours或log.retention.bytes)。默认:300000
max.connections.per.ip The maximum number of connections we allow from each ip address。默认:2147483647
max.connections.per.ip.overrides Per-ip or hostname overrides to the default maximum number of connections。默认:""
num.partitions 每个topic的分区个数,会被topic创建时指定参数覆盖。默认:1
principal.builder.class The fully qualified name of a class that implements the PrincipalBuilder interface, which is currently used to build the Principal for connections with the SSL SecurityProtocol.默认:class org.apache.kafka.common.security.auth.DefaultPrincipalBuilder
producer.purgatory.purge.interval.requests The purge interval (in number of requests) of the producer request purgatory。默认:1000
replica.fetch.backoff.ms The amount of time to sleep when fetch partition error occurs。默认:1000
replica.fetch.max.bytes follower每次fetch数据的最大尺寸。默认:1048576,1M
replica.fetch.response.max.bytes Maximum bytes expected for the entire fetch response. This is not an absolute maximum, if the first message in the first non-empty partition of the fetch is larger than this value, the message will still be returned to ensure that progress can be made. The maximum message size accepted by the broker is defined via message.max.bytes (broker config) or max.message.bytes (topic config)。默认:10485760,10M
reserved.broker.max.id Max number that can be used for a broker.id。默认:1000
sasl.enabled.mechanisms The list of SASL mechanisms enabled in the Kafka server. The list may contain any mechanism for which a security provider is available. Only GSSAPI is enabled by default。默认:GSSAPI
sasl.kerberos.kinit.cmd Kerberos kinit command path。默认:/usr/bin/kinit
sasl.kerberos.min.time.before.relogin Login thread sleep time between refresh attempts。默认:60000
sasl.kerberos.principal.to.local.rules A list of rules for mapping from principal names to short names (typically operating system usernames). The rules are evaluated in order and the first rule that matches a principal name is used to map it to a short name. Any later rules in the list are ignored. By default, principal names of the form {username}/{hostname}@{REALM} are mapped to {username}. For more details on the format please see security authorization and acls。默认:DEFAULT
sasl.kerberos.service.name The Kerberos principal name that Kafka runs as. This can be defined either in Kafka's JAAS config or in Kafka's config。默认:null
sasl.kerberos.ticket.renew.jitter Percentage of random jitter added to the renewal time。默认:0.05
sasl.kerberos.ticket.
renew.window.factor
Login thread will sleep until the specified window factor of time from last refresh to ticket's expiry has been reached, at which time it will try to renew the ticket。默认:0.8
sasl.mechanism.inter.broker.protocol SASL mechanism used for inter-broker communication. Default is GSSAPI。默认:GSSAPI
security.inter.broker.protocol Security protocol used to communicate between brokers. Valid values are: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL。默认:PLAINTEXT
ssl.cipher.suites A list of cipher suites. This is a named combination of authentication, encryption, MAC and key exchange algorithm used to negotiate the security settings for a network connection using TLS or SSL network protocol. By default all the available cipher suites are supported。默认:null
ssl.client.auth Configures kafka broker to request client authentication. The following settings are common:
  • ssl.client.auth=required If set to required client authentication is required.
  • ssl.client.auth=requested This means client authentication is optional. unlike requested , if this option is set client can choose not to provide authentication information about itself
  • ssl.client.auth=none This means client authentication is not needed.
。默认:none
ssl.enabled.protocols The list of protocols enabled for SSL connections。默认:TLSv1.2, TLSv1.1, TLSv1
ssl.key.password The password of the private key in the key store file. This is optional for client。默认:null
ssl.keymanager.algorithm The algorithm used by key manager factory for SSL connections. Default value is the key manager factory algorithm configured for the Java Virtual Machine。默认:SunX509
ssl.keystore.location The location of the key store file. This is optional for client and can be used for two-way authentication for client。默认:null
ssl.keystore.password The store password for the key store file. This is optional for client and only needed if ssl.keystore.location is configured。默认:null
ssl.keystore.type The file format of the key store file. This is optional for client。默认:JKS
ssl.protocol The SSL protocol used to generate the SSLContext. Default setting is TLS, which is fine for most cases. Allowed values in recent JVMs are TLS, TLSv1.1 and TLSv1.2. SSL, SSLv2 and SSLv3 may be supported in older JVMs, but their usage is discouraged due to known security vulnerabilities。默认:TLS
ssl.provider The name of the security provider used for SSL connections. Default value is the default security provider of the JVM。默认:null
ssl.trustmanager.algorithm The algorithm used by trust manager factory for SSL connections. Default value is the trust manager factory algorithm configured for the Java Virtual Machine。默认:PKIX
ssl.truststore.location The location of the trust store file。默认:null
ssl.truststore.password The password for the trust store file。默认:null
ssl.truststore.type The file format of the trust store file。默认:JKS
authorizer.class.name The authorizer class that should be used for authorization。默认:""
metric.reporters A list of classes to use as metrics reporters. Implementing the MetricReporter interface allows plugging in classes that will be notified of new metric creation. The JmxReporter is always included to register JMX statistics。默认:[]
metrics.num.samples The number of samples maintained to compute metrics。默认:2
metrics.sample.window.ms The window of time a metrics sample is computed over。默认:30000
quota.window.num The number of samples to retain in memory for client quotas。默认:11
The time span of each sample for client quotas。默认:1
replication.quota.window.num The number of samples to retain in memory for replication quotas。默认:11
replication.quota.window.size.seconds The time span of each sample for replication quotas。默认:1000
ssl.endpoint.identification.algorithm The endpoint identification algorithm to validate server hostname using server certificate。默认:null
ssl.secure.random.implementation The SecureRandom PRNG implementation to use for SSL cryptography operations。默认:null
zookeeper.sync.time.ms How far a ZK follower can be behind a ZK leader。默认:2000

2. Topic 相关配置

Name Description Server Default Property
cleanup.policy A string that is either "delete" or "compact". This string designates the retention policy to use on old log segments. The default policy ("delete") will discard old segments when their retention time or size limit has been reached. The "compact" setting will enable log compaction on the topic。默认:delete log.cleanup.policy
compression.type Specify the final compression type for a given topic. This configuration accepts the standard compression codecs ('gzip', 'snappy', lz4). It additionally accepts 'uncompressed' which is equivalent to no compression; and 'producer' which means retain the original compression codec set by the producer。默认:producer compression.type
delete.retention.ms 保留日志压缩主题的删除逻辑删除标记的时间。 如果使用者从偏移量0开始,以确保他们获得最后阶段的有效快照,此设置还限制了使用者必须完成读取的时间(否则,在他们完成扫描之前,可能已收集了删除逻辑删除)。默认:86400000 log.cleaner.delete.retention.ms
file.delete.delay.ms The time to wait before deleting a file from the filesystem。默认:60000 log.segment.delete.delay.ms
flush.messages This setting allows specifying an interval at which we will force an fsync of data written to the log. For example if this was set to 1 we would fsync after every message; if it were 5 we would fsync after every five messages. In general we recommend you not set this and use replication for durability and allow the operating system's background flush capabilities as it is more efficient. This setting can be overridden on a per-topic basis (see the per-topic configuration section)。默认:9223372036854775807 log.flush.interval.messages
flush.ms 在强制fsync一个partition的log文件之前暂存的消息数量。调低这个值会更频繁的sync数据到磁盘,影响性能。通常建议人家使用replication来确保持久性,而不是依靠单机上的fsync,但是这可以带来更多的可靠性。默认:9223372036854775807 log.flush.interval.ms
follower.replication.
throttled.replicas
A list of replicas for which log replication should be throttled on the follower side. The list should describe a set of replicas in the form [PartitionId]:[BrokerId],[PartitionId]:[BrokerId]:... or alternatively the wildcard '*' can be used to throttle all replicas for this topic。默认:[] follower.replication.
throttled.replicas
index.interval.bytes This setting controls how frequently Kafka adds an index entry to it's offset index. The default setting ensures that we index a message roughly every 4096 bytes. More indexing allows reads to jump closer to the exact position in the log but makes the index larger. You probably don't need to change this。默认:4096 log.index.interval.bytes
leader.replication.
throttled.replicas
A list of replicas for which log replication should be throttled on the leader side. The list should describe a set of replicas in the form [PartitionId]:[BrokerId],[PartitionId]:[BrokerId]:... or alternatively the wildcard '*' can be used to throttle all replicas for this topic。默认:[] leader.replication.
throttled.replicas
max.message.bytes This is largest message size Kafka will allow to be appended. Note that if you increase this size you must also increase your consumer's fetch size so they can fetch messages this large。默认:1000012 message.max.bytes
message.format.version Specify the message format version the broker will use to append messages to the logs. The value should be a valid ApiVersion. Some examples are: 0.8.2, 0.9.0.0, 0.10.0, check ApiVersion for more details. By setting a particular message format version, the user is certifying that all the existing messages on disk are smaller or equal than the specified version. Setting this value incorrectly will cause consumers with older versions to break as they will receive messages with a format that they don't understand。默认:0.10.1-IV2 log.message.format.version
message.timestamp.
difference.max.ms
The maximum difference allowed between the timestamp when a broker receives a message and the timestamp specified in the message. If message.timestamp.type=CreateTime, a message will be rejected if the difference in timestamp exceeds this threshold. This configuration is ignored if message.timestamp.type=LogAppendTime。默认:9223372036854775807 log.message.timestamp.
difference.max.ms
message.timestamp.type Define whether the timestamp in the message is message create time or log append time. The value should be either `CreateTime` or `LogAppendTime`。默认:CreateTime log.message.timestamp.type
min.cleanable.dirty.ratio This configuration controls how frequently the log compactor will attempt to clean the log (assuming log compaction is enabled). By default we will avoid cleaning a log where more than 50% of the log has been compacted. This ratio bounds the maximum space wasted in the log by duplicates (at 50% at most 50% of the log could be duplicates). A higher ratio will mean fewer, more efficient cleanings but will mean more wasted space in the log。默认:0.5 log.cleaner.min.cleanable.ratio
min.compaction.lag.ms The minimum time a message will remain uncompacted in the log. Only applicable for logs that are being compacted。默认:0 log.cleaner.min.compaction.lag.ms
min.insync.replicas When a producer sets acks to "all" (or "-1"), min.insync.replicas specifies the minimum number of replicas that must acknowledge a write for the write to be considered successful. If this minimum cannot be met, then the producer will raise an exception (either NotEnoughReplicas or NotEnoughReplicasAfterAppend).
When used together, min.insync.replicas and acks allow you to enforce greater durability guarantees. A typical scenario would be to create a topic with a replication factor of 3, set min.insync.replicas to 2, and produce with acks of "all". This will ensure that the producer raises an exception if a majority of replicas do not receive a write。默认:1
min.insync.replicas
preallocate Should pre allocate file when create new segment?。默认:false log.preallocate
retention.bytes This configuration controls the maximum size a log can grow to before we will discard old log segments to free up space if we are using the "delete" retention policy. By default there is no size limit only a time limit。默认:-1 log.retention.bytes
retention.ms This configuration controls the maximum time we will retain a log before we will discard old log segments to free up space if we are using the "delete" retention policy. This represents an SLA on how soon consumers must read their data。默认:604800000 log.retention.ms
segment.bytes This configuration controls the segment file size for the log. Retention and cleaning is always done a file at a time so a larger segment size means fewer files but less granular control over retention。默认:1073741824 log.segment.bytes
segment.index.bytes 对于segment索引文件的大小限制,默认为10M。默认:10485760,10M log.index.size.max.bytes
segment.jitter.ms The maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling。默认:0 log.roll.jitter.ms
segment.ms This configuration controls the period of time after which Kafka will force the log to roll even if the segment file isn't full to ensure that retention can delete or compact old data。默认:604800000 log.roll.ms
unclean.leader.election.enable Indicates whether to enable replicas not in the ISR set to be elected as leader as a last resort, even though doing so may result in data loss。默认:true unclean.leader.election.enable

3. Producer 相关配置

Name Description
bootstrap.servers 指定broker的地址列表,格式为:host1:port1,host2:port2,...,不必将全部broker地址都写上
key.serializer 必须是一个实现org.apache.kafka.common.serialization.Serializer接口的类,将key序列化成字节数组。注意:key.serializer必须被设置,即使消息中没有指定key。
value.serializer 必须是一个实现org.apache.kafka.common.serialization.Serializer接口的类,将value序列化成字节数组。
acks acks控制多少个副本必须写入消息后生产者才能认为写入成功,这个参数对消息丢失可能性有很大影响。这个参数有三种取值:
**1.** acks=0:生产者把消息发送到broker即认为成功,不等待broker的处理结果。这种方式的吞吐最高,但也是最容易丢失消息的。
**2.** acks=1:生产者会在该分区的Leader写入消息并返回成功后,认为消息发送成功。如果群首写入消息失败,生产者会收到错误响应并进行重试。这种方式能够一定程度避免消息丢失,但如果群首宕机时该消息没有复制到其他副本,那么该消息还是会丢失。另外,如果我们使用同步方式来发送,延迟会比前一种方式大大增加(至少增加一个网络往返时间);如果使用异步方式,应用感知不到延迟,吞吐量则会受异步正在发送中的数量限制。
**3.** acks=all:生产者会等待所有副本成功写入该消息,这种方式是最安全的,能够保证消息不丢失,但是延迟也是最大的。默认:1
buffer.memory 设置生产者缓冲发送的消息的内存大小,如果应用调用send方法的速度大于生产者发送的速度,那么调用会阻塞或者抛出异常,具体行为取决于block.on.buffer.full(这个参数在0.9.0.0版本被max.block.ms代替,允许抛出异常前等待一定时间)参数。默认:33554432
compression.type The compression type for all data generated by the producer. The default is none (i.e. no compression). Valid values are none, gzip, snappy, or lz4. Compression is of full batches of data, so the efficacy of batching will also impact the compression ratio (more batching means better compression)。默认:none
retries 当生产者发送消息收到一个可恢复异常时,会进行重试,这个参数指定了重试的次数。默认值为0,在实际情况中,这个参数需要结合retry.backoff.ms(重试等待间隔)来使用,建议总的重试时间比集群重新选举群首的时间长,这样可以避免生产者过早结束重试导致失败。
**注意**:此重试与客户端收到错误时重新发送消息是没有区别的。
在配置max.in.flight.requests.per.connection不等于1的情况下,允许重试可能会改变消息的顺序,
因为如果两个批次的消息被发送到同一个分区,第一批消息发送失败但第二批成功,而第一批消息会被重新发送,则第二批消息会先被写入。默认:0
ssl.key.password The password of the private key in the key store file. This is optional for client。默认:null
ssl.keystore.location The location of the key store file. This is optional for client and can be used for two-way authentication for client。默认:null
ssl.keystore.password The store password for the key store file. This is optional for client and only needed if ssl.keystore.location is configured. 。默认:null
ssl.truststore.location The location of the trust store file. 。默认:null
ssl.truststore.password The password for the trust store file. 。默认:null
batch.size 当多条消息发送到一个分区时,生产者会进行批量发送,这个参数指定了批量消息的大小上限(以字节为单位)。当批量消息达到这个大小时,生产者会一起发送到broker;但即使没有达到这个大小,生产者也会有定时机制来发送消息,避免消息延迟过大。默认:16384,16KB
client.id An id string to pass to the server when making requests. The purpose of this is to be able to track the source of requests beyond just ip/port by allowing a logical application name to be included in server-side request logging。默认:""
connections.max.idle.ms Close idle connections after the number of milliseconds specified by this config。默认:540000
linger.ms 生产者在发送批量消息前等待的时间,当设置此参数后,即便没有达到批量消息的指定大小,到达时间后生产者也会发送批量消息到broker。默认情况下,生产者的发送消息线程只要空闲了就会发送消息,即便只有一条消息。设置这个参数后,发送线程会等待一定的时间,这样可以批量发送消息增加吞吐量,但同时也会增加延迟。默认:0
max.block.ms 指定应用调用send方法或者获取元数据方法(例如partitionFor)时的阻塞时间,超过此时间则抛出timeout异常。默认:60000
max.request.size 一批次消息最大值,1M,请求的最大大小为字节,请求的最大字节数。这也是对最大记录尺寸的有效覆盖。注意:server具有自己对消息记录尺寸的覆盖,这些尺寸和这个设置不同。此项设置将会限制producer每次批量发送请求的数目,以防发出巨量的请求。默认:1048576
partitioner.class Partitioner class that implements the Partitioner interface。默认:org.apache.kafka.clients.producer.internals.DefaultPartitioner
receive.buffer.bytes The size of the TCP receive buffer (SO_RCVBUF) to use when reading data. If the value is -1, the OS default will be used。默认:32768
request.timeout.ms The configuration controls the maximum amount of time the client will wait for the response of a request. If the response is not received before the timeout elapses the client will resend the request if necessary or fail the request if retries are exhausted。默认:30000
sasl.kerberos.service.name The Kerberos principal name that Kafka runs as. This can be defined either in Kafka's JAAS config or in Kafka's config。默认:null
sasl.mechanism SASL mechanism used for client connections. This may be any mechanism for which a security provider is available. GSSAPI is the default mechanism。默认:GSSAPI
security.protocol Protocol used to communicate with brokers. Valid values are: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL。默认:PLAINTEXT
send.buffer.bytes 发送数据时要使用的TCP发送缓冲区(SO_SNDBUF)的大小。 如果值为-1,则将使用操作系统默认值。默认:131072
ssl.enabled.protocols The list of protocols enabled for SSL connections。默认:TLSv1.2, TLSv1.1, TLSv1
ssl.keystore.type The file format of the key store file. This is optional for client。默认:JKS
ssl.protocol The SSL protocol used to generate the SSLContext. Default setting is TLS, which is fine for most cases. Allowed values in recent JVMs are TLS, TLSv1.1 and TLSv1.2. SSL, SSLv2 and SSLv3 may be supported in older JVMs, but their usage is discouraged due to known security vulnerabilities。默认:TLS
ssl.provider The name of the security provider used for SSL connections. Default value is the default security provider of the JVM。默认:null
ssl.truststore.type The file format of the trust store file。默认:JKS
timeout.ms The configuration controls the maximum amount of time the server will wait for acknowledgments from followers to meet the acknowledgment requirements the producer has specified with the acks configuration. If the requested number of acknowledgments are not met when the timeout elapses an error will be returned. This timeout is measured on the server side and does not include the network latency of the request。默认:30000
block.on.buffer.full When our memory buffer is exhausted we must either stop accepting new records (block) or throw errors. By default this setting is false and the producer will no longer throw a BufferExhaustException but instead will use the max.block.ms value to block, after which it will throw a TimeoutException. Setting this property to true will set the max.block.ms to Long.MAX_VALUE. Also if this property is set to true, parameter metadata.fetch.timeout.ms is no longer honored.

This parameter is deprecated and will be removed in a future release. Parameter max.block.ms should be used instead.

。默认:false
interceptor.classes A list of classes to use as interceptors. Implementing the ProducerInterceptor interface allows you to intercept (and possibly mutate) the records received by the producer before they are published to the Kafka cluster. By default, there are no interceptors。默认:null
max.in.flight.requests.per.connection 生产者在收到服务器响应之前可以发送的消息个数,设置此参数较高的值可以提高吞吐量,但同时也会增加内存消耗。另外,如果设置过高反而会降低吞吐量,因为批量消息效率降低。设置为1,可以保证发送到broker的顺序和调用send方法顺序一致,即便出现失败重试的情况也是如此。默认:5
metadata.fetch.timeout.ms 指定获取元数据(例如获取分区的群首信息)的等待响应时间。默认:60000
metadata.max.age.ms The period of time in milliseconds after which we force a refresh of metadata even if we haven't seen any partition leadership changes to proactively discover any new brokers or partitions。默认:300000
metric.reporters A list of classes to use as metrics reporters. Implementing the MetricReporter interface allows plugging in classes that will be notified of new metric creation. The JmxReporter is always included to register JMX statistics。默认:[]
metrics.num.samples The number of samples maintained to compute metrics。默认:2
metrics.sample.window.ms The window of time a metrics sample is computed over。默认:30000
reconnect.backoff.ms The amount of time to wait before attempting to reconnect to a given host. This avoids repeatedly connecting to a host in a tight loop. This backoff applies to all requests sent by the consumer to the broker。默认:50
retry.backoff.ms The amount of time to wait before attempting to retry a failed request to a given topic partition. This avoids repeatedly sending requests in a tight loop under some failure scenarios。默认:100
sasl.kerberos.kinit.cmd Kerberos kinit command path。默认:/usr/bin/kinit
sasl.kerberos.min.time.before.relogin Login thread sleep time between refresh attempts。默认:60000
sasl.kerberos.ticket.renew.jitter Percentage of random jitter added to the renewal time。默认:0.05
sasl.kerberos.ticket.renew.
window.factor
Login thread will sleep until the specified window factor of time from last refresh to ticket's expiry has been reached, at which time it will try to renew the ticket。默认:0.8
ssl.cipher.suites A list of cipher suites. This is a named combination of authentication, encryption, MAC and key exchange algorithm used to negotiate the security settings for a network connection using TLS or SSL network protocol. By default all the available cipher suites are supported。默认:null
ssl.endpoint.identification.algorithm The endpoint identification algorithm to validate server hostname using server certificate. 。默认:null
ssl.keymanager.algorithm The algorithm used by key manager factory for SSL connections. Default value is the key manager factory algorithm configured for the Java Virtual Machine。默认:SunX509
ssl.secure.random.implementation The SecureRandom PRNG implementation to use for SSL cryptography operations. 。默认:null
ssl.trustmanager.algorithm The algorithm used by trust manager factory for SSL connections. Default value is the trust manager factory algorithm configured for the Java Virtual Machine。默认:PKIX

4. New Consuemr 相关配置

Name Description
bootstrap.servers A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. The client will make use of all servers irrespective of which servers are specified here for bootstrapping—this list only impacts the initial hosts used to discover the full set of servers. This list should be in the form host1:port1,host2:port2,.... Since these servers are just used for the initial connection to discover the full cluster membership (which may change dynamically), this list need not contain the full set of servers (you may want more than one, though, in case a server is down).
key.deserializer Deserializer class for key that implements the Deserializer interface.
value.deserializer Deserializer class for value that implements the Deserializer interface.
fetch.min.bytes The minimum amount of data the server should return for a fetch request. If insufficient data is available the request will wait for that much data to accumulate before answering the request. The default setting of 1 byte means that fetch requests are answered as soon as a single byte of data is available or the fetch request times out waiting for data to arrive. Setting this to something greater than 1 will cause the server to wait for larger amounts of data to accumulate which can improve server throughput a bit at the cost of some additional latency。默认:1
group.id A unique string that identifies the consumer group this consumer belongs to. This property is required if the consumer uses either the group management functionality by using subscribe(topic) or the Kafka-based offset management strategy。默认:""
heartbeat.interval.ms The expected time between heartbeats to the consumer coordinator when using Kafka's group management facilities. Heartbeats are used to ensure that the consumer's session stays active and to facilitate rebalancing when new consumers join or leave the group. The value must be set lower than session.timeout.ms, but typically should be set no higher than 1/3 of that value. It can be adjusted even lower to control the expected time for normal rebalances。默认:3000
max.partition.fetch.bytes The maximum amount of data per-partition the server will return. If the first message in the first non-empty partition of the fetch is larger than this limit, the message will still be returned to ensure that the consumer can make progress. The maximum message size accepted by the broker is defined via message.max.bytes (broker config) or max.message.bytes (topic config). See fetch.max.bytes for limiting the consumer request size。默认:1048576
session.timeout.ms The timeout used to detect consumer failures when using Kafka's group management facility. The consumer sends periodic heartbeats to indicate its liveness to the broker. 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. Note that the value must be in the allowable range as configured in the broker configuration by group.min.session.timeout.ms and group.max.session.timeout.ms。默认:10000
ssl.key.password The password of the private key in the key store file. This is optional for client。默认:null
ssl.keystore.location The location of the key store file. This is optional for client and can be used for two-way authentication for client。默认:null
ssl.keystore.password The store password for the key store file. This is optional for client and only needed if ssl.keystore.location is configured。默认:null
ssl.truststore.location The location of the trust store file. 。默认:null
ssl.truststore.password The password for the trust store file. 。默认:null
auto.offset.reset What to do when there is no initial offset in Kafka or if the current offset does not exist any more on the server (e.g. because that data has been deleted):
  • earliest: automatically reset the offset to the earliest offset
  • latest: automatically reset the offset to the latest offset
  • none: throw exception to the consumer if no previous offset is found for the consumer's group
  • anything else: throw exception to the consumer.
。默认:latest
connections.max.idle.ms Close idle connections after the number of milliseconds specified by this config。默认:540000
enable.auto.commit If true the consumer's offset will be periodically committed in the background。默认:true
exclude.internal.topics Whether records from internal topics (such as offsets) should be exposed to the consumer. If set to true the only way to receive records from an internal topic is subscribing to it。默认:true
fetch.max.bytes The maximum amount of data the server should return for a fetch request. This is not an absolute maximum, if the first message in the first non-empty partition of the fetch is larger than this value, the message will still be returned to ensure that the consumer can make progress. The maximum message size accepted by the broker is defined via message.max.bytes (broker config) or max.message.bytes (topic config). Note that the consumer performs multiple fetches in parallel。默认:52428800
max.poll.interval.ms The maximum delay between invocations of poll() when using consumer group management. This places an upper bound on the amount of time that the consumer can be idle before fetching more records. If poll() is not called before expiration of this timeout, then the consumer is considered failed and the group will rebalance in order to reassign the partitions to another member. 。默认:300000
max.poll.records The maximum number of records returned in a single call to poll()。默认:500
partition.assignment.strategy The class name of the partition assignment strategy that the client will use to distribute partition ownership amongst consumer instances when group management is used。默认:org.apache.kafka.clients.consumer.RangeAssignor
receive.buffer.bytes 读取数据时要使用的TCP接收缓冲区(SO_RCVBUF)的大小。 如果值为-1,则将使用操作系统默认值。默认:65536
request.timeout.ms The configuration controls the maximum amount of time the client will wait for the response of a request. If the response is not received before the timeout elapses the client will resend the request if necessary or fail the request if retries are exhausted。默认:305000
sasl.kerberos.service.name The Kerberos principal name that Kafka runs as. This can be defined either in Kafka's JAAS config or in Kafka's config。默认:null
sasl.mechanism SASL mechanism used for client connections. This may be any mechanism for which a security provider is available. GSSAPI is the default mechanism。默认:GSSAPI
security.protocol Protocol used to communicate with brokers. Valid values are: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL。默认:PLAINTEXT
send.buffer.bytes The size of the TCP send buffer (SO_SNDBUF) to use when sending data. If the value is -1, the OS default will be used。默认:131072,128KB
ssl.enabled.protocols The list of protocols enabled for SSL connections。默认:TLSv1.2, TLSv1.1, TLSv1
ssl.keystore.type The file format of the key store file. This is optional for client。默认:JKS
ssl.protocol The SSL protocol used to generate the SSLContext. Default setting is TLS, which is fine for most cases. Allowed values in recent JVMs are TLS, TLSv1.1 and TLSv1.2. SSL, SSLv2 and SSLv3 may be supported in older JVMs, but their usage is discouraged due to known security vulnerabilities。默认:TLS
ssl.provider The name of the security provider used for SSL connections. Default value is the default security provider of the JVM。默认:null
ssl.truststore.type The file format of the trust store file。默认:JKS
auto.commit.interval.ms The frequency in milliseconds that the consumer offsets are auto-committed to Kafka if enable.auto.commit is set to true。默认:5000
check.crcs Automatically check the CRC32 of the records consumed. This ensures no on-the-wire or on-disk corruption to the messages occurred. This check adds some overhead, so it may be disabled in cases seeking extreme performance。默认:true
client.id 这个参数可以是任意字符串,它是broker用来识别消息是来自哪个客户端的。在broker进行打印日志、衡量指标或者配额限制时会用到。默认:""
fetch.max.wait.ms The maximum amount of time the server will block before answering the fetch request if there isn't sufficient data to immediately satisfy the requirement given by fetch.min.bytes。默认:500
interceptor.classes A list of classes to use as interceptors. Implementing the ConsumerInterceptor interface allows you to intercept (and possibly mutate) records received by the consumer. By default, there are no interceptors。默认:null
metadata.max.age.ms The period of time in milliseconds after which we force a refresh of metadata even if we haven't seen any partition leadership changes to proactively discover any new brokers or partitions。默认:300000
metric.reporters A list of classes to use as metrics reporters. Implementing the MetricReporter interface allows plugging in classes that will be notified of new metric creation. The JmxReporter is always included to register JMX statistics。默认:[]
metrics.num.samples The number of samples maintained to compute metrics。默认:2
metrics.sample.window.ms The window of time a metrics sample is computed over。默认:30000
reconnect.backoff.ms The amount of time to wait before attempting to reconnect to a given host. This avoids repeatedly connecting to a host in a tight loop. This backoff applies to all requests sent by the consumer to the broker。默认:50
retry.backoff.ms The amount of time to wait before attempting to retry a failed request to a given topic partition. This avoids repeatedly sending requests in a tight loop under some failure scenarios。默认:100
sasl.kerberos.kinit.cmd Kerberos kinit command path。默认:/usr/bin/kinit
sasl.kerberos.min.time.before.relogin Login thread sleep time between refresh attempts。默认:60000
sasl.kerberos.ticket.renew.jitter Percentage of random jitter added to the renewal time。默认:0.05
sasl.kerberos.ticket.
renew.window.factor
Login thread will sleep until the specified window factor of time from last refresh to ticket's expiry has been reached, at which time it will try to renew the ticket。默认:0.8
ssl.cipher.suites A list of cipher suites. This is a named combination of authentication, encryption, MAC and key exchange algorithm used to negotiate the security settings for a network connection using TLS or SSL network protocol. By default all the available cipher suites are supported。默认:null
ssl.endpoint.identification.algorithm The endpoint identification algorithm to validate server hostname using server certificate. 。默认:null
ssl.keymanager.algorithm The algorithm used by key manager factory for SSL connections. Default value is the key manager factory algorithm configured for the Java Virtual Machine。默认:SunX509
ssl.secure.random.implementation The SecureRandom PRNG implementation to use for SSL cryptography operations. 。默认:null
ssl.trustmanager.algorithm The algorithm used by trust manager factory for SSL connections. Default value is the trust manager factory algorithm configured for the Java Virtual Machine。默认:PKIX

5. Old Consuemr 相关配置

Property Description
group.id A string that uniquely identifies the group of consumer processes to which this consumer belongs. By setting the same group id multiple processes indicate that they are all part of the same consumer group.
zookeeper.connect Specifies the ZooKeeper connection string in the form hostname:port where host and port are the host and port of a ZooKeeper server. To allow connecting through other ZooKeeper nodes when that ZooKeeper machine is down you can also specify multiple hosts in the form hostname1:port1,hostname2:port2,hostname3:port3. The server may also have a ZooKeeper chroot path as part of its ZooKeeper connection string which puts its data under some path in the global ZooKeeper namespace. If so the consumer should use the same chroot path in its connection string. For example to give a chroot path of /chroot/path you would give the connection string as hostname1:port1,hostname2:port2,hostname3:port3/chroot/path.
consumer.id Generated automatically if not set.。默认:null
socket.timeout.ms The socket timeout for network requests. The actual timeout set will be max.fetch.wait + socket.timeout.ms。默认:30 * 1000
socket.receive.buffer.bytes socket服务器使用的接收缓冲区(SO_RCVBUF)。默认:64 * 1024
fetch.message.max.bytes fetch请求中,针对每次fetch消息的最大字节数。这些字节将会督导用于每个partition的内存中,因此,此设置将会控制consumer所使用的memory大小。这个fetch请求尺寸必须至少和server允许的最大消息尺寸相等,否则,producer可能发送的消息尺寸大于consumer所能消耗的尺寸。默认:1024 * 1024
num.consumer.fetchers The number fetcher threads used to fetch data。默认:1
auto.commit.enable If true, periodically commit to ZooKeeper the offset of messages already fetched by the consumer. This committed offset will be used when the process fails as the position from which the new consumer will begin。默认:true
auto.commit.interval.ms The frequency in ms that the consumer offsets are committed to zookeeper。默认:60 * 1000
queued.max.message.chunks Max number of message chunks buffered for consumption. Each chunk can be up to fetch.message.max.bytes。默认:2
rebalance.max.retries When a new consumer joins a consumer group the set of consumers attempt to "rebalance" the load to assign partitions to each consumer. If the set of consumers changes while this assignment is taking place the rebalance will fail and retry. This setting controls the maximum number of attempts before giving up。默认:4
fetch.min.bytes The minimum amount of data the server should return for a fetch request. If insufficient data is available the request will wait for that much data to accumulate before answering the request。默认:1
fetch.wait.max.ms The maximum amount of time the server will block before answering the fetch request if there isn't sufficient data to immediately satisfy fetch.min.bytes。默认:100
rebalance.backoff.ms Backoff time between retries during rebalance. If not set explicitly, the value in zookeeper.sync.time.ms is used。默认:2000
refresh.leader.backoff.ms Backoff time to wait before trying to determine the leader of a partition that has just lost its leader。默认:200
auto.offset.reset What to do when there is no initial offset in ZooKeeper or if an offset is out of range:
* smallest : automatically reset the offset to the smallest offset
* largest : automatically reset the offset to the largest offset
* anything else: throw exception to the consumer。默认:largest
consumer.timeout.ms Throw a timeout exception to the consumer if no message is available for consumption after the specified interval。默认:-1
exclude.internal.topics Whether messages from internal topics (such as offsets) should be exposed to the consumer。默认:true
client.id The client id is a user-specified string sent in each request to help trace calls. It should logically identify the application making the request。默认:group id value
zookeeper.session.timeout.ms  ZooKeeper的最大超时时间,若是超过时间仍没有反映,那么认为该节点已经挂掉。默认:6000
zookeeper.connection.timeout.ms 客户端与Zookeeper建立连接时等待的最长时间。默认:6000
zookeeper.sync.time.ms  ZooKeeper集群中leader和follower之间的同步时间,换句话说:一个ZK follower能落后leader多久。默认:2000
offsets.storage Select where offsets should be stored (zookeeper or kafka)。默认:zookeeper
offsets.channel.backoff.ms The backoff period when reconnecting the offsets channel or retrying failed offset fetch/commit requests。默认:1000
offsets.channel.socket.timeout.ms Socket timeout when reading responses for offset fetch/commit requests. This timeout is also used for ConsumerMetadata requests that are used to query for the offset manager。默认:10000
offsets.commit.max.retries Retry the offset commit up to this many times on failure. This retry count only applies to offset commits during shut-down. It does not apply to commits originating from the auto-commit thread. It also does not apply to attempts to query for the offset coordinator before committing offsets. i.e., if a consumer metadata request fails for any reason, it will be retried and that retry does not count toward this limit。默认:5
dual.commit.enabled If you are using "kafka" as offsets.storage, you can dual commit offsets to ZooKeeper (in addition to Kafka). This is required during migration from zookeeper-based offset storage to kafka-based offset storage. With respect to any given consumer group, it is safe to turn this off after all instances within that group have been migrated to the new version that commits offsets to the broker (instead of directly to ZooKeeper)。默认:true
partition.assignment.strategy Select between the "range" or "roundrobin" strategy for assigning partitions to consumer streams.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 available partitions in numeric order and the consumer threads in lexicographic order. We then divide the number of partitions by the total number of consumer streams (threads) to determine the number of partitions to assign to each consumer. If it does not evenly divide, then the first few consumers will have one extra partition.。默认:range

6. Kafka Connect 相关配置

Name Description
config.storage.topic kafka topic to store configs
group.id A unique string that identifies the Connect cluster group this worker belongs to.
key.converter Converter class used to convert between Kafka Connect format and the serialized form that is written to Kafka. This controls the format of the keys in messages written to or read from Kafka, and since this is independent of connectors it allows any connector to work with any serialization format. Examples of common formats include JSON and Avro.
offset.storage.topic kafka topic to store connector offsets in
status.storage.topic kafka topic to track connector and task status
value.converter Converter class used to convert between Kafka Connect format and the serialized form that is written to Kafka. This controls the format of the values in messages written to or read from Kafka, and since this is independent of connectors it allows any connector to work with any serialization format. Examples of common formats include JSON and Avro.
internal.key.converter Converter class used to convert between Kafka Connect format and the serialized form that is written to Kafka. This controls the format of the keys in messages written to or read from Kafka, and since this is independent of connectors it allows any connector to work with any serialization format. Examples of common formats include JSON and Avro. This setting controls the format used for internal bookkeeping data used by the framework, such as configs and offsets, so users can typically use any functioning Converter implementation.
internal.value.converter Converter class used to convert between Kafka Connect format and the serialized form that is written to Kafka. This controls the format of the values in messages written to or read from Kafka, and since this is independent of connectors it allows any connector to work with any serialization format. Examples of common formats include JSON and Avro. This setting controls the format used for internal bookkeeping data used by the framework, such as configs and offsets, so users can typically use any functioning Converter implementation.
bootstrap.servers A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. The client will make use of all servers irrespective of which servers are specified here for bootstrapping—this list only impacts the initial hosts used to discover the full set of servers. This list should be in the form host1:port1,host2:port2,.... Since these servers are just used for the initial connection to discover the full cluster membership (which may change dynamically), this list need not contain the full set of servers (you may want more than one, though, in case a server is down).。默认:localhost:9092
heartbeat.interval.ms The expected time between heartbeats to the group coordinator when using Kafka's group management facilities. Heartbeats are used to ensure that the worker's session stays active and to facilitate rebalancing when new members join or leave the group. The value must be set lower than session.timeout.ms, but typically should be set no higher than 1/3 of that value. It can be adjusted even lower to control the expected time for normal rebalances.。默认:3000
rebalance.timeout.ms The maximum allowed time for each worker to join the group once a rebalance has begun. This is basically a limit on the amount of time needed for all tasks to flush any pending data and commit offsets. If the timeout is exceeded, then the worker will be removed from the group, which will cause offset commit failures.。默认:60000
session.timeout.ms The timeout used to detect worker failures. The worker sends periodic heartbeats to indicate its liveness to the broker. If no heartbeats are received by the broker before the expiration of this session timeout, then the broker will remove the worker from the group and initiate a rebalance. Note that the value must be in the allowable range as configured in the broker configuration by group.min.session.timeout.ms and group.max.session.timeout.ms.。默认:10000
ssl.key.password The password of the private key in the key store file. This is optional for client.。默认:null
ssl.keystore.location The location of the key store file. This is optional for client and can be used for two-way authentication for client.。默认:null
ssl.keystore.password The store password for the key store file. This is optional for client and only needed if ssl.keystore.location is configured。默认:null
ssl.truststore.location The location of the trust store file。默认:null
ssl.truststore.password The password for the trust store file。默认:null
connections.max.idle.ms Close idle connections after the number of milliseconds specified by this config.。默认:540000
receive.buffer.bytes The size of the TCP receive buffer (SO_RCVBUF) to use when reading data. If the value is -1, the OS default will be used.。默认:32768
request.timeout.ms The configuration controls the maximum amount of time the client will wait for the response of a request. If the response is not received before the timeout elapses the client will resend the request if necessary or fail the request if retries are exhausted.。默认:40000
sasl.kerberos.service.name The Kerberos principal name that Kafka runs as. This can be defined either in Kafka's JAAS config or in Kafka's config.。默认:null
sasl.mechanism SASL mechanism used for client connections. This may be any mechanism for which a security provider is available. GSSAPI is the default mechanism.。默认:GSSAPI
security.protocol Protocol used to communicate with brokers. Valid values are: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL.。默认:PLAINTEXT
send.buffer.bytes The size of the TCP send buffer (SO_SNDBUF) to use when sending data. If the value is -1, the OS default will be used.。默认:131072
ssl.enabled.protocols The list of protocols enabled for SSL connections.。默认:TLSv1.2, TLSv1.1, TLSv1
ssl.keystore.type The file format of the key store file. This is optional for client.。默认:JKS
ssl.protocol The SSL protocol used to generate the SSLContext. Default setting is TLS, which is fine for most cases. Allowed values in recent JVMs are TLS, TLSv1.1 and TLSv1.2. SSL, SSLv2 and SSLv3 may be supported in older JVMs, but their usage is discouraged due to known security vulnerabilities.。默认:TLS
ssl.provider The name of the security provider used for SSL connections. Default value is the default security provider of the JVM.。默认:null
ssl.truststore.type The file format of the trust store file.。默认:JKS
worker.sync.timeout.ms When the worker is out of sync with other workers and needs to resynchronize configurations, wait up to this amount of time before giving up, leaving the group, and waiting a backoff period before rejoining.。默认:3000
worker.unsync.backoff.ms When the worker is out of sync with other workers and fails to catch up within worker.sync.timeout.ms, leave the Connect cluster for this long before rejoining.。默认:300000
access.control.allow.methods Sets the methods supported for cross origin requests by setting the Access-Control-Allow-Methods header. The default value of the Access-Control-Allow-Methods header allows cross origin requests for GET, POST and HEAD.。默认:""
access.control.allow.origin Value to set the Access-Control-Allow-Origin header to for REST API requests.To enable cross origin access, set this to the domain of the application that should be permitted to access the API, or '*' to allow access from any domain. The default value only allows access from the domain of the REST API.。默认:""
client.id An id string to pass to the server when making requests. The purpose of this is to be able to track the source of requests beyond just ip/port by allowing a logical application name to be included in server-side request logging.。默认:""
metadata.max.age.ms The period of time in milliseconds after which we force a refresh of metadata even if we haven't seen any partition leadership changes to proactively discover any new brokers or partitions.。默认:300000
metric.reporters A list of classes to use as metrics reporters. Implementing the MetricReporter interface allows plugging in classes that will be notified of new metric creation. The JmxReporter is always included to register JMX statistics.。默认:[]
metrics.num.samples The number of samples maintained to compute metrics.。默认:2
metrics.sample.window.ms The window of time a metrics sample is computed over.。默认:30000
offset.flush.interval.ms Interval at which to try committing offsets for tasks.。默认:60000
offset.flush.timeout.ms Maximum number of milliseconds to wait for records to flush and partition offset data to be committed to offset storage before cancelling the process and restoring the offset data to be committed in a future attempt.。默认:5000
reconnect.backoff.ms The amount of time to wait before attempting to reconnect to a given host. This avoids repeatedly connecting to a host in a tight loop. This backoff applies to all requests sent by the consumer to the broker.。默认:50
rest.advertised.host.name If this is set, this is the hostname that will be given out to other workers to connect to.。默认:null
rest.advertised.port If this is set, this is the port that will be given out to other workers to connect to.。默认:null
rest.host.name Hostname for the REST API. If this is set, it will only bind to this interface.。默认:null
rest.port Port for the REST API to listen on.。默认:8083
retry.backoff.ms The amount of time to wait before attempting to retry a failed request to a given topic partition. This avoids repeatedly sending requests in a tight loop under some failure scenarios.。默认:100
sasl.kerberos.kinit.cmd Kerberos kinit command path.。默认:/usr/bin/kinit
sasl.kerberos.min.time.before.relogin Login thread sleep time between refresh attempts.。默认:60000
sasl.kerberos.ticket.renew.jitter Percentage of random jitter added to the renewal time.。默认:0.05
sasl.kerberos.ticket.
renew.window.factor
Login thread will sleep until the specified window factor of time from last refresh to ticket's expiry has been reached, at which time it will try to renew the ticket.。默认:0.8
ssl.cipher.suites A list of cipher suites. This is a named combination of authentication, encryption, MAC and key exchange algorithm used to negotiate the security settings for a network connection using TLS or SSL network protocol. By default all the available cipher suites are supported.。默认:null
ssl.endpoint.identification.algorithm The endpoint identification algorithm to validate server hostname using server certificate。默认:null
ssl.keymanager.algorithm The algorithm used by key manager factory for SSL connections. Default value is the key manager factory algorithm configured for the Java Virtual Machine.。默认:SunX509
ssl.secure.random.implementation The SecureRandom PRNG implementation to use for SSL cryptography operations。默认:null
ssl.trustmanager.algorithm The algorithm used by trust manager factory for SSL connections. Default value is the trust manager factory algorithm configured for the Java Virtual Machine.。默认:PKIX
task.shutdown.graceful.timeout.ms Amount of time to wait for tasks to shutdown gracefully. This is the total amount of time, not per task. All task have shutdown triggered, then they are waited on sequentially.。默认:5000

文章作者: hnbian
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 hnbian !
评论
 上一篇
Kafka总结(四)kafka auto.offset.reset参数说明 Kafka总结(四)kafka auto.offset.reset参数说明
1. 参数说明 当各分区下有已提交的offset时(默认使用latest) 参数 说明 earliest 从提交的offset开始消费;无提交的offset时,从头开始消费 latest 从提交的offset开始消费;无提
2020-02-14
下一篇 
Kafka总结(二)常见组件下 Topic、Partition等介绍 Kafka总结(二)常见组件下 Topic、Partition等介绍
1. CAP理论分布式系统中,一致性,可用性,分区容忍性大多数情况下只能同时满足两个,一般分区容忍性都要有保障,因此很多时候是在可用性可一致性之间做权衡。 一致性(Consistency) 通过某个节点的写操作结果对后面通过其他节点的读
2020-02-10
  目录