Kafka的配置文件通常命名为server.properties
,它位于Kafka安装目录的config
文件夹中。这个文件包含了Kafka服务器的各种配置参数。以下是一些基本的配置项及其说明:
broker.id
listeners
listeners=PLAINTEXT://your.host.name:9092
advertised.listeners
log.dirs
zookeeper.connect
zookeeper.connect=localhost:2181
num.partitions
default.replication.factor
min.insync.replicas
log.retention.hours
log.segment.bytes
num.network.threads
num.io.threads
socket.send.buffer.bytes
socket.receive.buffer.bytes
socket.request.max.bytes
log.flush.interval.messages
log.flush.interval.ms
group.initial.rebalance.delay.ms
# The id of the broker. This must be set to a unique integer for each broker.
broker.id=0
# Listeners the broker will use to accept client connections.
listeners=PLAINTEXT://your.host.name:9092
# Advertised listeners provide a way for clients to connect to the broker.
advertised.listeners=PLAINTEXT://your.host.name:9092
# The directory under which the log data will be stored.
log.dirs=/tmp/kafka-logs
# Zookeeper connection string (see zookeeper docs for details).
zookeeper.connect=localhost:2181
# The default number of partitions per topic.
num.partitions=1
# The default replication factor for topics.
default.replication.factor=1
# The minimum age of a log file to be eligible for deletion due to age.
log.retention.hours=168
# The maximum size of the log segment files.
log.segment.bytes=1073741824
# The number of threads to use for network I/O operations.
num.network.threads=3
# The number of threads to use for I/O operations.
num.io.threads=8
# The send buffer size used in sockets.
socket.send.buffer.bytes=102400
# The receive buffer size used in sockets.
socket.receive.buffer.bytes=102400
# The maximum size of the request that the server will accept.
socket.request.max.bytes=104857600
# The number of messages to buffer before flushing to disk.
log.flush.interval.messages=10000
# The number of milliseconds after which data will be flushed to disk.
log.flush.interval.ms=5000
希望这些信息对你有所帮助!如果有任何其他问题,请随时提问。