kafka 的 server.properties 文件 描述


紅色 :是源配置文件中 備注

藍色:英文備注,翻譯

綠色:解釋說明(若有不對,請下方留言說明)

版本:基於 kafka 2.4.0  http://archive.apache.org/dist/kafka/2.4.0/kafka_2.11-2.4.0.tgz

# Licensed to the Apache Software Foundation (ASF) under one or more (授權給Apache軟件基金會(ASF)一個或多個
# contributor license agreements. See the NOTICE file distributed with 貢獻者許可協議。請參閱隨附的通知文件
# this work for additional information regarding copyright ownership.這是關於版權所有權的附加信息。
# The ASF licenses this file to You under the Apache License, Version 2.0ASF根據Apache許可2.0版將此文件授權給您
# (the "License"); you may not use this file except in compliance with(“許可證”);除非符合規定,否則您不能使用此文件
# the License. You may obtain a copy of the License at許可。你可於
#
# http://www.apache.org/licenses/LICENSE-2.0http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software除非適用法律要求或經書面同意,軟件
# distributed under the License is distributed on an "AS IS" BASIS,在許可下發布的是“按現狀”發布的,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.沒有任何明示或暗示的保證或條件。
# See the License for the specific language governing permissions and有關特定語言的管理權限和
# limitations under the License.許可的限制。

# see kafka.server.KafkaConfig for additional details and defaults看到kafka.server。獲取更多的細節和默認值

上面的意思大概講述了  ASF批准了Apache許可證的2.0版本,該許可證幫助我們實現了通過協作開源軟件開發來提供可靠且壽命長的軟件產品的目標。

除非另有明確說明,否則A​​SF產生的所有軟件包均根據Apache許可版本2.0隱含許可。具體可以到 http://www.apache.org/licenses/LICENSE-2.0 進行查看。

沒啥好說的...

############################# Server Basics #############################

# The id of the broker. This must be set to a unique integer for each broker.代理的id。必須為每個代理設置一個惟一的整數

在Kafka集群中,每個broker都有一個唯一的id值用來區分彼此。Kafka在啟動時會在zookeeper中/brokers/ids路徑下創建一個與當前broker的id為名稱的虛節點,Kafka的健康狀態檢查就依賴於此節點。

當broker下線時,該虛節點會自動刪除,其他broker或者客戶端通過判斷/brokers/ids路徑下是否有此broker的id來確定該broker的健康狀態。

可以通過配置文件config/server.properties里的broker.id參數來配置broker的id值,默認情況下broker.id值為-1。Kafka broker的id值必須大於等於0時才有可能正常啟動,但是這里並不是只能通過配置文件config/server.properties來修改這個值,還可以通過meta.properties文件或者自動生成功能來實現broker的id值的設置。
————————————————
版權聲明:本文為CSDN博主「朱小廝」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/u013256816/article/details/80546337

broker.id=0

############################# Socket Server Settings #############################

# The address the socket server listens on. It will get the value returned from套接字服務器監聽的地址。它將獲得返回的值
# java.net.InetAddress.getCanonicalHostName() if not configured.()
#    FORMAT:
#    listeners = listener_name://host_name:port
#    EXAMPLE:
#   listeners = PLAINTEXT://your.host.name:9092

#listeners=PLAINTEXT://:9092

# Hostname and port the broker will advertise to producers and consumers. If not set,代理將向生產者和消費者發布主機名和端口。如果未設置,
# it uses the value for "listeners" if configured. Otherwise, it will use the value則在配置時使用“偵聽器”的值。
# returned from java.net.InetAddress.getCanonicalHostName().否則,它將使用java.net.InetAddress.getCanonicalHostName()返回的值。
#advertised.listeners=PLAINTEXT://your.host.name:9092

# Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details將監聽器名稱映射到安全協議,默認情況下它們是相同的。
#listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL有關詳細信息,請參閱配置文檔listener.security.protocol。map=明文:明文,SSL:SSL,

# The number of threads that the server uses for receiving requests from the network and sending responses to the networksasl_明文:sasl_明文,SASL_SSL:SASL_SSL服務器用於從網絡接收請求和向網絡發送響應的線程數

默認處理網絡請求的線程個數

num.network.threads=3

# The number of threads that the server uses for processing requests, which may include disk I/O服務器用於處理請求的線程數,可能包括磁盤I/O

執行磁盤IO操作的默認線程個數 

num.io.threads=8

# The send buffer (SO_SNDBUF) used by the socket server套接字服務器使用的發送緩沖區(SO_SNDBUF)

socket服務使用的進行發送數據的緩沖區大小,默認100kb

socket.send.buffer.bytes=102400

# The receive buffer (SO_RCVBUF) used by the socket server套接字服務器使用的接收緩沖區(SO_RCVBUF)

socket服務使用的進行接受數據的緩沖區大小,默認100kb

socket.receive.buffer.bytes=102400

# The maximum size of a request that the socket server will accept (protection against OOM)套接字服務器將接受的請求的最大大小(針對OOM的保護)

socket服務所能夠接受的最大的請求量,防止出現OOM(Out of memory)內存溢出,默認值為:100m
(應該是socker server所能接受的一個請求的最大大小,默認為100M)

socket.request.max.bytes=104857600


############################# Log Basics #############################

# A comma separated list of directories under which to store log files一個逗號分隔的目錄列表,用於存儲日志文件

雖然這里叫做 logs(見名知意,認為是存儲kafka日志的),但是這里是存儲數據和日志的。之所以叫 logs 是因為 kafka文件的后綴為log
log.dirs=/app/ywjcproject/kafka_2.11-2.4.0/logs

# The default number of log partitions per topic. More partitions allow greater每個主題的默認日志分區數。 
# parallelism for consumption, but this will also result in more files across更多的分區允許更大的並行度,但這也會導致更多的文件跨代理。
# the brokers.

每一個topic所對應的log的partition分區數目,默認1個。更多的partition數目會提高消費
並行度,但是也會導致在kafka集群中有更多的文件進行傳輸
(partition就是分布式存儲,相當於是把一份數據分開幾份來進行存儲,即划分塊、划分分區的意思)

num.partitions=1

# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.每個數據目錄用於啟動時的日志恢復和關機時的刷新的線程數。
# This value is recommended to be increased for installations with data dirs located in RAID array.對於安裝RAID陣列中有數據dirs的情況,建議增加此值。

每一個數據目錄用於在啟動kafka時恢復數據和在關閉時刷新數據的線程個數。如果kafka數據存儲在磁盤陣列中
建議此值可以調整更大。

num.recovery.threads.per.data.dir=1

############################# Internal Topic Settings #############################
# The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state"組元數據內部主題“_consumer_offsets”和“_transaction_state”的復制因子對於開發測試以外的任何測試
# For anything other than development testing, a value greater than 1 is recommended to ensure availability such as 3.建議使用大於1的值來確保可用性,如3。
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1

############################# Log Flush Policy #############################

# Messages are immediately written to the filesystem but by default we only fsync() to sync消息被立即寫入文件系統,但在默認情況下,我們僅使用fsync()對操作系統緩存進行延遲同步。
# the OS cache lazily. The following configurations control the flush of data to disk.以下配置控制數據到磁盤的刷新。
# There are a few important trade-offs here:這里有一些重要的權衡:
# 1. Durability: Unflushed data may be lost if you are not using replication.1。持久性:如果不使用復制,未刷新的數據可能會丟失。
# 2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.2. 延遲:非常大的刷新間隔可能會導致延遲峰值,因為會有大量數據需要刷新。
# 3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks.3.吞吐量:刷新通常是最昂貴的操作,一個小的刷新間隔可能導致過多的查找。
# The settings below allow one to configure the flush policy to flush data after a period of time or下面的設置允許您配置刷新策略,以便在一段時間后或每N條消息(或同時包含N條消息)刷新數據。
# every N messages (or both). This can be done globally and overridden on a per-topic basis.這可以在全局范圍內完成,並在每個主題的基礎上覆蓋。

# The number of messages to accept before forcing a flush of data to disk在將數據刷新到磁盤之前要接受的消息數

消息刷新到磁盤中的消息條數閾值 單位毫秒

#log.flush.interval.messages=10000

# The maximum amount of time a message can sit in a log before we force a flush在強制刷新之前,消息可以駐留在日志中的最長時間

消息刷新到磁盤生成一個log數據文件的時間間隔 單位毫秒

#log.flush.interval.ms=1000

############################# Log Retention Policy #############################

# The following configurations control the disposal of log segments. The policy can以下配置控制日志段的處理。
# be set to delete segments after a period of time, or after a given size has accumulated.可以將策略設置為在一段時間之后或在積累了給定的大小之后刪除段。
# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens只要滿足*其中*一個條件,段就會被刪除。刪除總是發生在日志的末尾。
# from the end of the log.

# The minimum age of a log file to be eligible for deletion due to age日志文件的最小刪除年齡

基於時間的策略,刪除日志數據的時間,默認保存7天

log.retention.hours=168

# A size-based retention policy for logs. Segments are pruned from the log unless the remaining基於日志大小的保留策略。除非其余段位於log. retene .bytes下,否則將從日志中刪除段。
# segments drop below log.retention.bytes. Functions independently of log.retention.hours.功能獨立於日志。保持。小時。

基於大小的策略,1G

#log.retention.bytes=1073741824

# The maximum size of a log segment file. When this size is reached a new log segment will be created.日志段文件的最大大小。當達到這個大小時,將創建一個新的日志段。

數據分片策略 1G

log.segment.bytes=1073741824

# The interval at which log segments are checked to see if they can be deleted according檢查日志段以確定是否可以根據其刪除的間隔
# to the retention policies保留政策

每隔多長時間檢測數據是否達到刪除條件

log.retention.check.interval.ms=300000

############################# Zookeeper #############################

# Zookeeper connection string (see zookeeper docs for details).Zookeeper連接字符串(詳見Zookeeper文檔)。
# This is a comma separated host:port pairs, each corresponding to a zk這是一個逗號分隔的主機:端口對,每個對應一個zk服務器
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".如。“127.0.0.1:3000 127.0.0.1:3001 127.0.0.1:3002”。
# You can also append an optional chroot string to the urls to specify the您還可以向url附加一個可選的chroot字符串,以指定所有kafka znodes的根目錄。
# root directory for all kafka znodes.
zookeeper.connect=localhost:2181

# Timeout in ms for connecting to zookeeper連接到zookeeper的ms超時
zookeeper.connection.timeout.ms=6000


############################# Group Coordinator Settings #############################

# The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance.下面的配置指定了GroupCoordinator延遲初始消費者再平衡的時間(以毫秒為單位)。
# The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members join the group, up to a maximum of max.poll.interval.ms.隨着新成員加入該組織,再平衡將進一步被group.initial.rebalance.delay.ms的值所延遲,其最大值為max.poll.interval.ms。
# The default value for this is 3 seconds.默認值是3秒。
# We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.我們在這里將其重寫為0,因為它為開發和測試提供了更好的開箱即用體驗。
# However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup.然而,在生產環境中,3秒的默認值更合適,因為這將有助於避免在應用程序啟動期間進行不必要的、可能代價高昂的重新平衡。
group.initial.rebalance.delay.ms=0

 


上面 綠色解釋 大部分來源於 https://www.cnblogs.com/toutou/p/linux_install_kafka.html  

本篇博客會在開發及學習kafka中不定時更新。 我剛接觸 kafka,文章中肯定有很多錯誤地方,若你有幸看到此文章,並且看到文章中的錯誤,請下方留言,我們一起討論學習。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM