3. CONFIGURATION

Kafka uses key-value pairs in the  property file format  for configuration. These values can be supplied either from a file or programmatically.


3、配置信息

Kafka使用key-value格式配置信息。这些配置可以从配置文件中获取或者是程序中的默认值。

3.1 Broker Configs

The essential configurations are the following:
  • broker.id
  • log.dirs
  • zookeeper.connect
Topic-level configurations and defaults are discussed in more detail  below .


3.1 Broker配置

基本的配置信息包含以下:

-broker.id

-log.dirs

-zookeeper.connect

Topic-level的配置以及默认值请阅读下面


NAME DESCRIPTION TYPE DEFAULT VALID VALUES IMPORTANCE
zookeeper.connect Zookeeper host string

zookeeper host字符串
string

high
advertised.host.name DEPRECATED: only used when `advertised.listeners` or `listeners` are not set. Use `advertised.listeners` instead. Hostname to publish to ZooKeeper for clients to use. In IaaS environments, this may need to be different from the interface to which the broker binds. If this is not set, it will use the value for `host.name` if configured. Otherwise it will use the value returned from java.net.InetAddress.getCanonicalHostName().

已废弃:只有当‘advertised.listeners'或者’listeners'没有设置时才使用。目前使用‘advertised.listeners'代替。主机名传递到zookeeper,以供客户端使用。在laaS环境中,这个名字可能与broker绑定的名字不同。如果这个值没有设置,如果‘host.name’选项设置了,系统将会使用’host.name'的值,否则系统会返回java.net.InetAddress.getCanonicalHostName()错误。
string null
high
advertised.listeners Listeners to publish to ZooKeeper for clients to use, if different than the listeners above. In IaaS environments, this may need to be different from the interface to which the broker binds. If this is not set, the value for `listeners` will be used.

如果这个值和上面的listeners配置不同,将会传递此值到zookeeper以供客户端使用。在laaS环境中,这个值可能与brokers绑定的名字不同。如果没有设置这个值,系统会使用‘listeners'
string null
high
advertised.port DEPRECATED: only used when `advertised.listeners` or `listeners` are not set. Use `advertised.listeners` instead. The port to publish to ZooKeeper for clients to use. In IaaS environments, this may need to be different from the port to which the broker binds. If this is not set, it will publish the same port that the broker binds to.

已废弃:只有当没有设置‘advertised.listeners'和’listeners'时才使用这个值。目前使用‘advertised.listeners'作为替代。这是发布到zookeeper上,以供客户端使用。在laaS环境中,这个可能和broker绑定的端口不同。如果这个值没有设置,一般会使用broker绑定的端口。
int null
high
auto.create.topics.enable Enable auto creation of topic on the server

是否允许在server上自动创建topic
boolean true
high
auto.leader.rebalance.enable Enables auto leader balancing. A background thread checks and triggers leader balance if required at regular intervals

是否允许leader的自动平衡。如果允许的话,会有后台线程检查并触发leader的均衡操作。
boolean true
high
background.threads The number of threads to use for various background processing tasks

后台处理任务的线程数
int 10 [1,...] high
broker.id The broker id for this server. If unset, a unique broker id will be generated.To avoid conflicts between zookeeper generated broker id's and user configured broker id's, generated broker ids start from reserved.broker.max.id + 1.

当前server的broker id。如果没有设置,系统会自动分配一个唯一的broker id。为了避免在zookeeper自动产生的broker id和用户配置的broker id之间产生冲突,自动产生的broker一般是从reserved.broker.max.id + 1开始的。
int -1
high
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.

指定某个topic消息压缩类型。此配置接受标准压缩编码器(’gzip‘,’snappy‘,’lz4‘)。另外也接受非压缩模式。‘producer'是指压缩编码器由producer指定。
string producer
high
delete.topic.enable Enables delete topic. Delete topic through the admin tool will have no effect if this config is turned off

是否允许删除topic。如果设置为否,则官方版本的工具将无法删除topic
boolean false
high
host.name DEPRECATED: only used when `listeners` is not set. Use `listeners` instead. hostname of broker. If this is set, it will only bind to this address. If this is not set, it will bind to all interfaces

已废弃:
只有当’listeners'没有设置时,才使用这个值。目前采用‘listeners'作为替代。如果设置了这个选项,broker只会绑定到这个地址,如果没有设置这个值,broker将会绑定到所有对外host name。
string ""
high
leader.imbalance.check.interval.seconds The frequency with which the partition rebalance check is triggered by the controller

controlles检查是否进行partitions重新负载均衡的频率,单位为秒
long 300
high
leader.imbalance.per.broker.percentage The ratio of leader imbalance allowed per broker. The controller would trigger a leader balance if it goes above this value per broker. The value is specified in percentage.

每个broker允许的leader失衡比例。如果某个broker的leader失衡数已经大于这个数值,则controller会触发leader的负载均衡。这个值以百分比的方式给出。
int 10
high
listeners Listener List - Comma-separated list of URIs we will listen on and their protocols. Specify hostname as 0.0.0.0 to bind to all interfaces. Leave hostname empty to bind to default interface. Examples of legal listener lists: PLAINTEXT://myhost:9092,TRACE://:9091 PLAINTEXT://0.0.0.0:9092, TRACE://localhost:9093

监听列表-以逗号分隔的URIs列表,指明了broker需要监听的hostname以及协议。需要指出的是,当指定hostname为0.0.0.0时,就是绑定此broker到所有hostname。如果留空hostname,则绑定到默认hostname。合法监听列表为:
PLAINTEXT://myhost:9092,TRACE://:9091 PLAINTEXT://0.0.0.0:9092, TRACE://localhost:9093
string null
high
log.dir The directory in which the log data is kept (supplemental for log.dirs property)

日志存储的目录,log.dirs作为此配置的补充选项
string /tmp/kafka-logs
high
log.dirs The directories in which the log data is kept. If not set, the value in log.dir is used

日志存储的多个目录列表。如果没有配置此选项,则使用log.dir配置
string null
high
log.flush.interval.messages The number of messages accumulated on a log partition before messages are flushed to disk

消息回刷到磁盘之前,内存所保存的每个partition的消息总数
long 9223372036854775807 [1,...] high
log.flush.interval.ms The maximum time in ms that a message in any topic is kept in memory before flushed to disk. If not set, the value in log.flush.scheduler.interval.ms is used

消息回刷到磁盘之前,消息在内存中保存的最长时间。如果没有设置,则使用log.flush.scheduler.interval.ms的值。
long null
high
log.flush.offset.checkpoint.interval.ms The frequency with which we update the persistent record of the last flush which acts as the log recovery point

由于内存中的日志并不是立刻回刷到磁盘,所以确定回刷到磁盘的消息才是在当前broker崩溃重启之后可以恢复的点。查看broker日志目录,可以看到两个文件,其中一个文件就是保存每个topic-partition的recover point的文件。因此,这个值就是更新这个恢复点的频率间隔。

int 60000 [0,...] high
log.flush.scheduler.interval.ms The frequency in ms that the log flusher checks whether any log needs to be flushed to disk

日志回刷器检查是否将任何日志回刷到磁盘的频率。
long 9223372036854775807
high
log.retention.bytes The maximum size of the log before deleting it

日志删除之前的最大尺寸
long -1
high
log.retention.hours The number of hours to keep a log file before deleting it (in hours), tertiary to log.retention.ms property

日志删除之前保存的小时数,默认时168小时,即2周;优先级相对于log.retention.ms为第三
int 168
high
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

日志删除前保存的分钟数。优先级相对于log.retention.ms为第二,如果没有设置这个值,则使用log.retention.hours
int null
high
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

日志删除之前保存的ms数。如果没有设置,则使用log.retention.minutes
long null
high
log.roll.hours The maximum time before a new log segment is rolled out (in hours), secondary to log.roll.ms property

滚动生成新日志的最大时间间隔,优先级相对于log.roll.ms为第二
int 168 [1,...] high
log.roll.jitter.hours The maximum jitter to subtract from logRollTimeMillis (in hours), secondary to log.roll.jitter.ms property

相对于logRollTimeMillis出现的最大时间偏差,相对于log.poll.jitter.ms为第二优先级。
int 0 [0,...] high
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

相对于logRollTimeMillis出现的最大时间偏差,如果没有设置此值,则使用log.roll.jitter.hours
long null
high
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

滚动生成新日志的最大时间间隔,如果没有设置此值,则使用log.roll.hours
long null
high
log.segment.bytes The maximum size of a single log file

单独的日志文件最大尺寸。
int 1073741824 [14,...] high
log.segment.delete.delay.ms The amount of time to wait before deleting a file from the filesystem

从文件系统中删除文件所等待的最长时间。
long 60000 [0,...] high
message.max.bytes The maximum size of message that the server can receive

server可以接收的最大消息尺寸
int 1000012 [0,...] high
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.

当producer设置ack选项为‘all'或者’-1‘时,此值指定了server成功写入的最少备份数,只有写入达到了此备份数,server才能返回正确写入的确认消息。如果没有实现成功写入这个最少备份数,server会抛出异常(either NotEnoughReplicas or NotEnoughReplicasAfterAppend)。一块使用min.sync.replicas和acks可以提高写入消息可用性。典型的用法是,将topic的备份数设置为3,将此值设置为2,然后producer可以设置ack为‘all’。这将使得server在大部分备份节点没有成功写入消息抛出异常。
int 1 [1,...] high
num.io.threads The number of io threads that the server uses for carrying out network requests

server用来获取网络请求的io线程数。
int 8 [1,...] high
num.network.threads the number of network threads that the server uses for handling network requests

server用来处理网络请求的网络线程数
int 3 [1,...] high
num.recovery.threads.per.data.dir The number of threads per data directory to be used for log recovery at startup and flushing at shutdown

在启动和正常终止期间,用于每个数据目录进行日志恢复的线程数
int 1 [1,...] high
num.replica.fetchers Number of fetcher threads used to replicate messages from a source broker. Increasing this value can increase the degree of I/O parallelism in the follower broker.

用于从leader broker获取消息的线程数。提高这个值可以提高follower broker的并行处理能力。
int 1
high
offset.metadata.max.bytes The maximum size for a metadata entry associated with an offset commit

与offset提交相关联的元数据条目的最大大小
int 4096
high
offsets.commit.required.acks The required acks before the commit can be accepted. In general, the default (-1) should not be overridden

提交接受之前所要求的acks。一般来说。默认值-1不应当改变。
注:日志发送到broker,虽然broker成功接收到,但是并没有提交到日志中去,所以在真正提交到日志之前,需要所有的broker都真正收到这条日志。
short -1
high
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.

在topics的备份接收到这次提交之前或者超时之前,此次offset提交可以等待的时间。这个和producer请求的超时时间比较相似。
int 5000 [1,...] high
offsets.load.buffer.size Batch size for reading from the offsets segments when loading offsets into the cache.

加载offsets到缓存时从offsets段中批量读取的数量
int 5242880 [1,...] high
offsets.retention.check.interval.ms Frequency at which to check for stale offsets

检查稳定offset的频率
long 600000 [1,...] high
offsets.retention.minutes Log retention window in minutes for offsets topic

对offsets topic来说,日志删除窗口时间
int 1440 [1,...] high
offsets.topic.compression.codec Compression codec for the offsets topic - compression may be used to achieve "atomic" commits

对于offsets topic的压缩编码器-压缩可以实现原子提交
int 0
high
offsets.topic.num.partitions The number of partitions for the offset commit topic (should not change after deployment)

offset提交topic的partitions数目(一旦部署,不应该改变)
int 50 [1,...] high
offsets.topic.replication.factor The replication factor for the offsets topic (set higher to ensure availability). To ensure that the effective replication factor of the offsets topic is the configured value, the number of alive brokers has to be at least the replication factor at the time of the first request for the offsets topic. If not, either the offsets topic creation will fail or it will get a replication factor of min(alive brokers, configured replication factor)

offsets topic的备份数,值越大可靠性越高。为保证offsets topic有效备份数是配置的数值,活跃brokers的数目最低为备份数目。如果达不到这个数值,offsets topic会创建失败,或者只能获得二者之中较小者(活跃的brokers,所配置的备份数目)
short 3 [1,...] high
offsets.topic.segment.bytes The offsets topic segment bytes should be kept relatively small in order to facilitate faster log compaction and cache loads

offsets topic段字节应当相对比较小,以便于获取更快的日志压缩以及缓存负载。
int 104857600 [1,...] high
port DEPRECATED: only used when `listeners` is not set. Use `listeners` instead. the port to listen and accept connections on

已废弃:
只有当‘listeners'没有设置时才使用。使用’listeners'作为替代。监听的端口号以及接受链接的端口号。
int 9092
high
queued.max.requests The number of queued requests allowed before blocking the network threads

队列中请求的最大个数,超过这个值就会阻塞网络请求。
int 500 [1,...] high
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

已废弃:
只有没有为zookeeper或者在zookeeper中没有配置默认的动态配额时才会使用。任何由clientid或者consumer group区分的consumer只要每秒获取的数据会小于这个值。
long 9223372036854775807 [1,...] high
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

已废弃:
只有当没有为zookeeper或者在zookeeper中没有配置动态的配额时才回使用。任何以clientid区分的producer在每秒中获取的字节数会小于这个值。
long 9223372036854775807 [1,...] high
replica.fetch.min.bytes Minimum bytes expected for each fetch response. If not enough bytes, wait up to replicaMaxWaitTimeMs

每次抓取消息时所期待应答的最小尺寸。如果没有足够的字节,等待 replicaMaxWaitTimeMs长的时间。
int 1
high
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

followers备份时抓取消息等待的最长时间。这个值一般小于replica.lag.time.max.ms,以防止ISR列表由于follower的超时的不断变化
int 500
high
replica.high.watermark.checkpoint.interval.ms The frequency with which the high watermark is saved out to disk

高水印保存到磁盘的频率。这个涉及到kafka的内存管理,由于写入kafka的数据分为两种:一种是写入kafka broker内存的,但是并没有写入磁盘,这种数据是不可恢复的;一种是写入内存也写入磁盘的,这种数据是可以恢复的,高水印其实就是这两种数据的分界线。
long 5000
high
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

如果follower没有发送任何同步请求或者没有从leader没有同步到最新offset,如果上述情况持续了这个值代表的时间,那么leader会从isr将这个follower移除。
long 10000
high
replica.socket.receive.buffer.bytes The socket receive buffer for network requests

网络请求中socket 收到缓存的最大尺寸。
int 65536
high
replica.socket.timeout.ms The socket timeout for network requests. Its value should be at least replica.fetch.wait.max.ms

网络请求中socket超市时间。它的值最小是replica.fetch.wait.max.ms
int 30000
high
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.

客户端等待broker应答的超时时间。如果超时了,客户端没有收到应答,如果必要的话可能会重发请求,如果重试都失败了也可能会报请求失败
int 30000
high
socket.receive.buffer.bytes The SO_RCVBUF buffer of the socket sever sockets. If the value is -1, the OS default will be used.

server 的socket缓存SO_RCVBUF。如果设置为-1,将使用OS的默认值
int 102400
high
socket.request.max.bytes The maximum number of bytes in a socket request

socket请求的最大字节数
int 104857600 [1,...] high
socket.send.buffer.bytes The SO_SNDBUF buffer of the socket sever sockets. If the value is -1, the OS default will be used.

server的socket的SO_SNDBUF缓存。如果设置为-1,将使用OS的默认值
int 102400
high
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

指明是否允许不在ISR列表中的备份节点称为新leader,即使这么做会造成数据丢失
boolean true
high
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

客户端与zookeeper建立链接时等待的最长时间。如果没有设置,将会使用zookeeper.session.timeout.ms的值
int null
high
zookeeper.session.timeout.ms Zookeeper session timeout

zookeeper回话超时时间
int 6000
high
zookeeper.set.acl Set client to use secure ACLs

设置客户端使用安全的ACLs权限控制
boolean false
high
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.

允许server自动分配broker id。当设置这个值时,需要仔细察看reserved.broker.max.id的值,以防止自动产生的broker.id和配置的broker.id冲突
boolean true
medium
broker.rack Rack of the broker. This will be used in rack aware replication assignment for fault tolerance. Examples: `RACK1`, `us-east-1d`

broker的支架?
用来在支架感知备份中的容错;例如:
‘RACK1’, ‘us-east-1d'
string null
medium
connections.max.idle.ms Idle connections timeout: the server socket processor threads close the connections that idle more than this

空闲链接的超时时间:server socket处理线程会关闭超时的链接。
long 600000
medium
controlled.shutdown.enable Enable controlled shutdown of the server

是否允许server受控的终止。
boolean true
medium
controlled.shutdown.max.retries Controlled shutdown can fail for multiple reasons. This determines the number of retries when such failure happens

受控制的终止因为多种原因失败。这个决定了控制终止失败时重试的次数
int 3
medium
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.

在每次重试之前,系统需要时间从引发先前失败的状态恢复过来(控制失败有可能因为replica lag等)。这个配置决定了在重试之前等待的时间。
long 5000
medium
controller.socket.timeout.ms The socket timeout for controller-to-broker channels

controller-to-broker的信道socket的超时时间
int 30000
medium
default.replication.factor default replication factors for automatically created topics

自动创建的topic默认的备份数
int 1
medium
fetch.purgatory.purge.interval.requests The purge interval (in number of requests) of the fetch request purgatory

抓取请求的清除时间间隔
int 1000
medium
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.

每个已注册consumers的最大会话超时时间。超时越长,consumers在两次心跳之间处理消息的时间就越长,同样需要花费更多的时间去检测失联错误。
int 300000
medium
group.min.session.timeout.ms The minimum allowed session timeout for registered consumers. Shorter timeouts leader to quicker failure detection at the cost of more frequent consumer heartbeating, which can overwhelm broker resources.

已注册的consumers最小的会话超市时间。超时越小,leader越快检查失联错误,同样需要更多的consumers心跳链接,这可能过度耗费brokers的资源。
int 6000
medium
inter.broker.protocol.version Specify which version of the inter-broker protocol will be used. This is typically bumped after all brokers were upgraded to a new version. Example of some valid values are: 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 Check ApiVersion for the full list.

指定了broker内部的协议版本。这个一般是在所有brokers都升级到新版本之后才能升级的。例如,正确的值是:
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.查看API版本可以获取完整的版本列表
string 0.10.1-IV2
medium
log.cleaner.backoff.ms The amount of time to sleep when there are no logs to clean

当没有日志清除时,cleaner睡眠的时间
long 15000 [0,...] medium
log.cleaner.dedupe.buffer.size The total memory used for log deduplication across all cleaner threads

日志删除线程所需要的内存总大小
long 134217728
medium
log.cleaner.delete.retention.ms How long are delete records retained?

保存删除日志多长时间
long 86400000
medium
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.

是否允许server运行日志删除进程。如果内部offsets topic使用的cleanup.policy=compact,则需要允许。如果不允许的话,则topics的数据不会压缩,并且越来越大
boolean true
medium
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

日志清除器复制缓存的负载因子。??
更高的值
double 0.9
medium
log.cleaner.io.buffer.size The total memory used for log cleaner I/O buffers across all cleaner threads

所有日志清除线程所使用的I/O缓存的总大小
int 524288 [0,...] medium
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

日志清除任务平均读写I/O的速度应该小于这个值
double 1.7976931348623157E308
medium
log.cleaner.min.cleanable.ratio The minimum ratio of dirty log to total log for a log to eligible for cleaning

需要清除的日志占总日志大小的最小比例,达到这个值时,需要清理
double 0.5
medium
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.

未压缩日志等待的最短时间;只适用于待压缩的日志
long 0
medium
log.cleaner.threads The number of background threads to use for log cleaning

用于日志清除的后台线程数
int 1 [0,...] medium
log.cleanup.policy The default cleanup policy for segments beyond the retention window. A comma separated list of valid policies. Valid policies are: "delete" and "compact"

清除过期日志的策略;后面使用逗号分隔的列表列举出正确的策略。正确的策略为:删除和压缩
list [delete] [compact, delete] medium
log.index.interval.bytes The interval with which we add an entry to the offset index

向offset索引添加条目的字节间隔:即每个多少个字节就新写入一条信息记录当前offset
int 4096 [0,...] medium
log.index.size.max.bytes The maximum size in bytes of the offset index

offset 索引的最大字节数
int 10485760 [4,...] medium
log.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.

指定broker上生成日志的格式版本;版本号和kafka API版本号相同。例如:0.8.2,0.9.0.0,0.10.0,更多版本号需要查看ApiVersion。通过设置特定的消息格式版本,用户可以确认所有磁盘上的消息格式都小于或者等于这个版本号。错误的设置这个版本号会导致低版本的consumer客户端在收到高版本消息无法识别的现象。
string 0.10.1-IV2
medium
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.

当broker收到消息并在此消息中打上时间戳时,此值代表两条消息时间戳之间的最大差值。如果log.message.timestamp.type=CreateTime,则当两条消息时间戳之间差值大于这个值时,broker应当拒绝接收消息。如果log.message.timestamp.type=LogAppendTime时,则忽略此配置。
long 9223372036854775807 [0,...] medium
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’或者‘LogAppendTime'之一。
估计创建时间是producer的时间,日志追加时间是broker的时间
string CreateTime [CreateTime, LogAppendTime] medium
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.

是否预分配新日志?如果在windows上使用kafka,需要预分配。
boolean false
medium
log.retention.check.interval.ms The frequency in milliseconds that the log cleaner checks whether any log is eligible for deletion

检查日志是否删除的频率间隔
long 300000 [1,...] medium
max.connections.per.ip The maximum number of connections we allow from each ip address

允许每个ip地址连接总数
int 2147483647 [1,...] medium
max.connections.per.ip.overrides Per-ip or hostname overrides to the default maximum number of connections

每个ip或者hostname覆盖默认连接的最大个数?
string ""
medium
num.partitions The default number of log partitions per topic

每个topic的partition的默认个数
int 1 [1,...] medium
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.

实现PrincipalBuilder接口的类的全名,目前用于创建符合SSL安全协议链接的Principal
class class org.apache.kafka.common.security.auth.DefaultPrincipalBuilder
medium
producer.purgatory.purge.interval.requests The purge interval (in number of requests) of the producer request purgatory

用于清除生产者无效链接的间隔(请求的个数)
int 1000
medium
replica.fetch.backoff.ms The amount of time to sleep when fetch partition error occurs.

每当遇到抓取partition消息错误时需要sleep的时间总数
int 1000 [0,...] medium
replica.fetch.max.bytes The number of bytes of messages to attempt to fetch for each partition. 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 viamessage.max.bytes (broker config) ormax.message.bytes (topic config).

尝试抓取每个partition消息的字节数。这个不是绝对的最大值,如果某次消息抓取中发现第一个非空partition的第一条消息大于这个值,则消息依然会返回给consumer以保证继续进行。broker可以接受的消息最大字节数位message.max.bytes(broker.config)或者max.message.bytes(topic config)
int 1048576 [0,...] medium
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 viamessage.max.bytes (broker config) ormax.message.bytes (topic config).

针对抓取消息请求的完整应答所包含的最大字节数。这个不是绝对的最大值,如果请求中的第一个非空partition的第一条消息大小大于这个值,消息依然会返回给客户端,以保证继续进行。broker可以接受的最大消息通过message.max.bytes(broker.config)或者max.message.bytes(topic config)设定
int 10485760 [0,...] medium
reserved.broker.max.id Max number that can be used for a broker.id

可以用于broker.id的最大个数
int 1000 [0,...] medium
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.

可以使用的SASL机制列表。这个列表可能包含任何可用的机制。默认只支持GSSAPI
list [GSSAPI]
medium
sasl.kerberos.kinit.cmd Kerberos kinit command path.

Kerberos kinit命令路径
string /usr/bin/kinit
medium
sasl.kerberos.min.time.before.relogin Login thread sleep time between refresh attempts.

在重试之间登陆线程的睡眠时间
long 60000
medium
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.

从主机名映射到短名字(一般是操作系统用户名)的规则列表。规则按照顺序进行匹配,第一个可以匹配上主机名的规则将使用它来映射主机名到短名字。后面其它的规则都将忽略。默认情况下,从{username}/{hostname}@{REALM}将映射到{username}。更多细节请查看security authorization and acls.
list [DEFAULT]
medium
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.

kafka运行的Kerberos主机名。可以在Kafka's JAAS配置或者Kafka's 配置中定义。
string null
medium
sasl.kerberos.ticket.renew.jitter Percentage of random jitter added to the renewal time.

添加到更新时间的随机抖动的百分比。
double 0.05
medium
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.

重新进行登录验证刷新之前,登录线程的睡眠时间
double 0.8
medium
sasl.mechanism.inter.broker.protocol SASL mechanism used for inter-broker communication. Default is GSSAPI.

broker内部进行通信的SASL机制。默认时GSSAPI
string GSSAPI
medium
security.inter.broker.protocol Security protocol used to communicate between brokers. Valid values are: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL.

brokers之间通信使用的安全协议。正确值为:PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL.
string PLAINTEXT
medium
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.

密码套件列表。 这是一种集认证,加密,MAC和密钥交换算法一块的命名组合,用于使用TLS或SSL网络协议协商网络连接的安全设置。 默认情况下,支持所有可用的密码套件。
list null
medium
ssl.client.auth Configures kafka broker to request client authentication. The following settings are common:
kafka broker应对客户端请求的授权。下面为具体配置:
  • 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意味着授权是可选的。不像requested,如果这样设置,客户端可以选择不提供授权信息
  • ssl.client.auth=none This means client authentication is not needed.不需要授权
none [required, requested, none] medium medium
ssl.enabled.protocols The list of protocols enabled for SSL connections.

SSL链接的协议
list [TLSv1.2, TLSv1.1, TLSv1]
medium
ssl.key.password The password of the private key in the key store file. This is optional for client.

存储在密钥文件中私有密钥。这个是可选的
password null
medium
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.

密钥管理器工厂用于SSL连接的算法。 默认值是为Java虚拟机配置的密钥管理器工厂算法。
string SunX509
medium
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.

密钥文件路径。这个是可选的
string null
medium
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.

密钥文件的密码。对于客户端来说是可选的,只有当ssl.keystore.location配置时才有用。
password null
medium
ssl.keystore.type The file format of the key store file. This is optional for client.

密钥文件的文件格式。对客户端来说是可选的。
string JKS
medium
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.

生成SSLContext的SSL协议。默认配置时TLS,适用于大部分情况。最近JVMS支持的协议包括:TLS,TLSv1.1,TLSv1.2.
SSL,SSLv2,SSLv3在老版本的JVMS中可用,但是由于知名的安全漏洞,它们并不受欢迎。
string TLS
medium
ssl.provider The name of the security provider used for SSL connections. Default value is the default security provider of the JVM.

SSL链接安全提供者名字。默认是JVM
string null
medium
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.

ssl链接信任管理者工厂的算法。默认时JVM支持的算法。
string PKIX
medium
ssl.truststore.location The location of the trust store file.

信任文件的路径
string null
medium
ssl.truststore.password The password for the trust store file.

信任文件的密码
password null
medium
ssl.truststore.type The file format of the trust store file.

信任文件的格式
string JKS
medium
authorizer.class.name The authorizer class that should be used for authorization

用于授权的授权类名
string ""
low
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.

用作度量报告器的类的列表。 实现MetricReporter接口允许插入将被通知新度量标准创建的类。 总是包括JmxReporter以注册JMX统计信息。

[]   low  
metrics.num.samples The number of samples maintained to compute metrics.

维持计算度量的样本数
int 2 [1,...] low
metrics.sample.window.ms The window of time a metrics sample is computed over.

度量样本的计算的时长
long 30000 [1,...] low
quota.window.num The number of samples to retain in memory for client quotas

在内存中为客户端配额保存的样本个数。
int 11 [1,...] low
quota.window.size.seconds The time span of each sample for client quotas


客户端配额的每个样本的时间跨度
int 1 [1,...] low
replication.quota.window.num The number of samples to retain in memory for replication quotas

要在备份配额的内存中保留的样本数
int 11 [1,...] low
replication.quota.window.size.seconds The time span of each sample for replication quotas
备份配额的每个样本的时间跨度
int 1 [1,...] low
ssl.endpoint.identification.algorithm The endpoint identification algorithm to validate server hostname using server certificate.

端点标识算法,使用服务器证书验证服务器主机名。
string null
low
ssl.secure.random.implementation The SecureRandom PRNG implementation to use for SSL cryptography operations.

用于SSL加密操作的SecureRandom PRNG实现。
string null
low
zookeeper.sync.time.ms How far a ZK follower can be behind a ZK leader

zk follower落后zk leader的时间
int 2000   low


More details about broker configuration can be found in the scala class kafka.server.KafkaConfig.

Topic-level configuration  Configurations pertinent to topics have both a server default as well an optional per-topic override. If no per-topic configuration is given the server default is used. The override can be set at topic creation time by giving one or more  --config  options. This example creates a topic named  my-topic  with a custom max message size and flush rate:
   > bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic my-topic --partitions 1
          --replication-factor 1 --config max.message.bytes=64000 --config flush.messages=1
  
更多有关broker 配置信息可以在scala类kafka.server.KafkaConfig中找到。

Topic-level配置中有关topics的配置既可以使用server级别的默认配置,也可以针对每个topic自己的配置。如果没有给定topic级别的配置,则默认使用server级别的。在topic创建时可以指定一个或者多个个性的配置以覆盖server级别的默认配置,具体方法是通过--config选项。以下为创建一个名为my-topic的topic,个性化配置最大消息尺寸和回刷磁盘速率为:

> bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic my-topic --partitions 1

          --replication-factor 1 --config max.message.bytes=64000 --config flush.messages=1


Overrides can also be changed or set later using the alter configs command. This example updates the max message size for  my-topic :
   > bin/kafka-configs.sh --zookeeper localhost:2181 --entity-type topics --entity-name my-topic --alter --add-config max.message.bytes=128000

这些个性化设置也可以通过alter配置命令进行移除。例如更新my-topic的最大消息:

> bin/kafka-configs.sh --zookeeper localhost:2181 --entity-type topics --entity-name my-topic --alter --add-config max.message.bytes=128000


To check overrides set on the topic you can do

   > bin/kafka-configs.sh --zookeeper localhost:2181 --entity-type topics --entity-name my-topic --describe
可以通过以下命令检查topic配置:

> bin/kafka-configs.sh --zookeeper localhost:2181 --entity-type topics --entity-name my-topic --describe


To remove an override you can do

   > bin/kafka-configs.sh --zookeeper localhost:2181  --entity-type topics --entity-name my-topic --alter --delete-config max.message.bytes
  
可以通过以下命令移除个性化配置:

> bin/kafka-configs.sh --zookeeper localhost:2181  --entity-type topics --entity-name my-topic --alter --delete-config max.message.bytes
  



The following are the topic-level configurations. The server's default configuration for this property is given under the Server Default Property heading. A given server default config value only applies to a topic if it does not have an explicit topic config override.

以下是topic级别的配置。每个选项的server级别的默认配置在前面server配置表中已经给出。如果某个topic级别已经显式设定,则server级别的默认值不在起作用。

NAME DESCRIPTION TYPE DEFAULT VALID VALUES SERVER DEFAULT PROPERTY IMPORTANCE
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”要么是“compact”;此值表明了针对老日志的清除策略。默认策略是删除,即丢弃过期日志,一旦删除时间或者尺寸限制到了就会执行。“compact”设置会压缩待删除日志。

list [delete] [compact, delete] log.cleanup.policy medium
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.


指定某个topic的消息的压缩格式。此配置接受标准化压缩编码器(‘gzip',’snappy',lz4)。也接受非压缩模式。’producer'意味着压缩编码器由producer设置。

string producer [uncompressed, snappy, lz4, gzip, producer] compression.type medium
delete.retention.ms

The amount of time to retain delete tombstone markers for log compacted topics. This setting also gives a bound on the time in which a consumer must complete a read if they begin from offset 0 to ensure that they get a valid snapshot of the final stage (otherwise delete tombstones may be collected before they complete their scan)


对进行日志压缩的topics保存删除标记的时间长度.此设置给出了consumer必须从0开始阅读消息的时间区间,在此区间内,consumer可以阅读正确的消息快照,否则删除标记到了之后消息有可能已经删除,consumer也就无法获取正确的消息了。

long 86400000 [0,...] log.cleaner.delete.retention.ms medium
file.delete.delay.ms

The time to wait before deleting a file from the filesystem


从文件系统中删除前的等待时间

long 60000 [0,...] log.segment.delete.delay.ms medium
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).


broker强制将消息回刷到磁盘日志文件的消息条数间隔。例如,如果设置为1,则每来一条消息都需要立刻写入磁盘。如果设置为5,则每来5条消息就会回刷消息进磁盘。一般来说,建议你不要更改这个值来确保消息可用性,而是使用备份机制提高消息可用性,允许操作系统的后台回刷能力更有效。这个设置可以是topic级别的。

long 9223372036854775807 [0,...] log.flush.interval.messages medium
flush.ms

This setting allows specifying a time interval at which we will force an fsync of data written to the log. For example if this was set to 1000 we would fsync after 1000 ms had passed. 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.


强制broker将消息回刷到磁盘日志的时间间隔。例如,如果设置为1000,即每隔1000ms,回刷一次。一般来说,不建议你通过更改这个值来提供消息可用性,而是允许操作系统后台回刷能力,这样效率更高

long 9223372036854775807 [0,...] log.flush.interval.ms medium
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端进行限制的日志备份的备份列表。此表通过一个备份的集合展示:[PartitionId]:[BrokerId],[PartitionId]:[BrokerId]:... 或者是通配符‘*’,可以用来限制topic的所有备份

list [] kafka.server.ThrottledReplicaListValidator$@59d57c39 follower.replication.throttled.replicas medium
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


kafka向offset索引添加条目的频率。默认设置保证我们妹4096个字节对一条消息进行加索引。索引越多,在跳转时越容易跳转到正确的位置,但是也会增大索引的空间。一般不需要改变这个值

int 4096 [0,...] log.index.interval.bytes medium
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端进行限制的日志备份的备份列表。这个列表可以通过一个集合来展示:[PartittionId]:[BrokerId],[PartitionId]:[BrokerId],....或者通过通配符‘*’来限制topic的所有的备份

list [] kafka.server.ThrottledReplicaListValidator$@59d57c39 leader.replication.throttled.replicas medium
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.


kafka broker可以追加的最大消息。注意,你可以提高这个值,与此同时,你也必须提高consumer可以消费的最大消息。

int 1000012 [0,...] message.max.bytes medium
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


指定broker可以追加的消息格式版本。此值应该是一个合法的APIVersion。一些例子如下:0.8.2,0.9.0.0,0.10.0,查看APIVersion可以获取更多细节。通过设置特定的消息格式版本,用户可以确认现存的消息格式版本都小于或者等于此版本号。设置不正确可能导致consumer无法解析消息。

string 0.10.1-IV2   log.message.format.version medium
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


broker收到消息的时间戳和消息中指定的时间戳之间的最大差值。如果message.timestamp.type=CreateTime,如果这个差值大于此配置的话,消息会被拒收。如果message.timestamp.type=LogAppendTIme,则此配置会被忽略

long 9223372036854775807 [0,...] log.message.timestamp.difference.max.ms medium
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’或者‘LogAppendTime'

string CreateTime   log.message.timestamp.type medium
min.cleanable.dirty.ratio

This configuration controls how frequently the log compactor will attempt to clean the log (assuminglog 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.


控制压缩器清除日志的频率(假定采用压缩机制)。more 情况下,如果超过50%的日志已经被压缩了,就暂时不用清除。这个比例控制日志浪费空间的大小(当压缩比例为50%时,最多浪费50%的空间)。此值越大,则清除效率越高,但是可能浪费更多空间。

double 0.5 [0,...,1] log.cleaner.min.cleanable.ratio medium
min.compaction.lag.ms

The minimum time a message will remain uncompacted in the log. Only applicable for logs that are being compacted


保留为压缩日志的最短时间。只有日志压缩时才起作用

long 0 [0,...] log.cleaner.min.compaction.lag.ms medium
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.


当producer设置acks为‘all’或者‘-1’,min.insync.replicas指定备份的最小值:即一次写入需要多少个备份确认写入时才能被认为写入成功。如果没有达到这个最小值,则producer可能会出现异常(或者是NoEnoughReplicas或者是NotEnoughReplicasAfterAppend)。

当min.insync.replicas和acks一块使用时,可以提高可用性保证。典型的用法是备份数设置为3,min.insync.replicas设置为2,producer的‘acks’设置为‘all’,这样将保证producer在没有收到大多数备份成功写入消息时会抛出异常。

int 1 [1,...] min.insync.replicas medium
preallocate

Should pre allocate file when create new segment?


是否预分配新日志文件

boolean false   log.preallocate medium
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.


日志删除之前的最大字节数。默认情况下没有尺寸限制

long -1   log.retention.bytes medium
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


日志删除之前保存的最长时间。

long 604800000   log.retention.ms medium
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


每个日志文件的最大字节数。删除和清除一般是在单个日志文件上展开的,如果日志文件越大,虽然可以减少文件数目,但是删除方面无法精确控制。

int 1073741824 [14,...] log.segment.bytes medium
segment.index.bytes

This configuration controls the size of the index that maps offsets to file positions. We preallocate this index file and shrink it only after log rolls. You generally should not need to change this setting


有关offsets和文件中位置的映射文件。一般是预分配这个文件,所以在存储目录中会发现无论何时,存储offsets和文件中位置的索引文件总是为10m。一般不需要更改这个文件。

int 10485760 [0,...] log.index.size.max.bytes medium
segment.jitter.ms

The maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling


控制日志滚动时间时允许出现的最大随机抖动时间,这是因为日志滚动没有办法精确控制,因为涉及到检查日志滚动有时间间隔以及删除日志的原因。

long 0 [0,...] log.roll.jitter.ms medium
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


日志滚动的时间间隔,即使日志大小没有达到日志滚动时的大小限制。这个有利于过期日志删除以及日志压缩。

long 604800000 [0,...] log.roll.ms medium
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


指明是否允许不在ISR中的备份节点是否允许被选为leader节点,当然这样有可能造成日志丢失

boolean true   unclean.leader.election.enable medium


Logo

Kafka开源项目指南提供详尽教程,助开发者掌握其架构、配置和使用,实现高效数据流管理和实时处理。它高性能、可扩展,适合日志收集和实时数据处理,通过持久化保障数据安全,是企业大数据生态系统的核心。

更多推荐