`

Kafka-broker配置说明

阅读更多

配置文件在config/server.properties

下面的一些配置可能是你需要进行修改的。

 

broker.id

整数,建议根据ip区分

 

log.dirs

kafka存放消息文件的路径,

默认/tmp/kafka-logs

port

broker用于接收producer消息的端口

 

zookeeper.connnect

zookeeper连接

格式为  ip1:port,ip2:port,ip3:port

message.max.bytes

单条消息的最大长度

 

num.network.threads

broker用于处理网络请求的线程数

如不配置默认为3,server.properties默认是2

num.io.threads

broker用于执行网络请求的IO线程数

如不配置默认为8,server.properties默认是2可适当增大,

queued.max.requests

排队等候IO线程执行的requests

默认为500

host.name

broker的hostname

默认null,建议写主机的ip,不然消费端不配置hosts会有麻烦

num.partitions

topic的默认分区数

默认1

log.retention.hours

消息被删除前保存多少小时

默认1周168小时

auto.create.topics.enable

是否可以程序自动创建Topic

默认true,建议false

default.replication.factor

消息备份数目

默认1不做复制,建议修改

num.replica.fetchers

用于复制leader消息到follower的IO线程数

默认1

 

 

下面的文档是官网给出的说明。

The essential configurations are the following:

  • broker.id
  • log.dirs
  • zookeeper.connect
PropertyDefaultDescription
broker.id   Each broker is uniquely identified by a non-negative integer id. This id serves as the brokers "name", and allows the broker to be moved to a different host/port without confusing consumers. You can choose any number you like so long as it is unique.
log.dirs /tmp/kafka-logs A comma-separated list of one or more directories in which Kafka data is stored. Each new partition that is created will be placed in the directory which currently has the fewest partitions.
port 6667 The port on which the server accepts client connections.
zookeeper.connect null Specifies the zookeeper connection string in the form hostname:port, where hostname and port are the host and port for a node in your zookeeper cluster. To allow connecting through other zookeeper nodes when that host is down you can also specify multiple hosts in the formhostname1:port1,hostname2:port2,hostname3:port3.

Zookeeper also allows you to add a "chroot" path which will make all kafka data for this cluster appear under a particular path. This is a way to setup multiple Kafka clusters or other applications on the same zookeeper cluster. To do this give a connection string in the formhostname1:port1,hostname2:port2,hostname3:port3/chroot/pathwhich would put all this cluster's data under the path /chroot/path. Note that you must create this path yourself prior to starting the broker and consumers must use the same connection string.

message.max.bytes 1000000 The maximum size of a message that the server can receive. It is important that this property be in sync with the maximum fetch size your consumers use or else an unruly consumer will be able to publish messages too large for consumers to consume.
num.network.threads 3 The number of network threads that the server uses for handling network requests. You probably don't need to change this.
num.io.threads 8 The number of I/O threads that the server uses for executing requests. You should have at least as many threads as you have disks.
queued.max.requests 500 The number of requests that can be queued up for processing by the I/O threads before the network threads stop reading in new requests.
host.name null

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, and publish one to ZK.

socket.send.buffer.bytes 100 * 1024 The SO_SNDBUFF buffer the server prefers for socket connections.
socket.receive.buffer.bytes 100 * 1024 The SO_RCVBUFF buffer the server prefers for socket connections.
socket.request.max.bytes 100 * 1024 * 1024

The maximum request size the server will allow. This prevents the server from running out of memory and should be smaller than the Java heap size.

num.partitions 1 The default number of partitions per topic.
log.segment.bytes 1024 * 1024 * 1024 The log for a topic partition is stored as a directory of segment files. This setting controls the size to which a segment file will grow before a new segment is rolled over in the log.
log.segment.bytes.per.topic "" This setting allows overriding log.segment.bytes on a per-topic basis
log.roll.hours 24 * 7 This setting will force Kafka to roll a new log segment even if the log.segment.bytes size has not been reached.
log.roll.hours.per.topic "" This setting allows overriding log.roll.hours on a per-topic basis.
log.retention.hours 24 * 7 The number of hours to keep a log segment before it is deleted, i.e. the default data retention window for all topics. Note that if both log.retention.hours and log.retention.bytes are both set we delete a segment when either limit is exceeded.
log.retention.hours.per.topic "" A per-topic override for log.retention.hours.
log.retention.bytes -1 The amount of data to retain in the log for each topic-partitions. Note that this is the limit per-partition so multiple by the number of partitions to get the total data retained for the topic. Also note that if both log.retention.hours and log.retention.bytes are both set we delete a segment when either limit is exceeded.
log.retention.bytes.per.topic "" A per-topic override for log.retention.bytes.
log.cleanup.interval.mins 10 The frequency in minutes that the log cleaner checks whether any log segment is eligible for deletion to meet the retention policies.
log.index.size.max.bytes 10 * 1024 * 1024 The maximum size in bytes we allow for the offset index for each log segment. Note that we will always pre-allocate a sparse file with this much space and shrink it down when the log rolls. If the index fills up we will roll a new log segment even if we haven't reached the log.segment.bytes limit.
log.index.interval.bytes 4096 The byte interval at which we add an entry to the offset index. When executing a fetch request the server must do a linear scan for up to this many bytes to find the correct position in the log to begin and end the fetch. So setting this value to be larger will mean larger index files (and a bit more memory usage) but less scanning. However the server will never add more than one index entry per log append (even if more than log.index.interval worth of messages are appended). In general you probably don't need to mess with this value.
log.flush.interval.messages 10000 The number of messages written to a log partition before we force an fsync on the log. Setting this higher will improve performance a lot but will increase the window of data at risk in the event of a crash (though that is usually best addressed through replication). If both this setting and log.flush.interval.ms are both used the log will be flushed when either criteria is met.
log.flush.interval.ms.per.topic "" The per-topic override for log.flush.interval.messages, e.g., topic1:3000,topic2:6000
log.flush.scheduler.interval.ms 3000 The frequency in ms that the log flusher checks whether any log is eligible to be flushed to disk.
log.flush.interval.ms 3000 The maximum time between fsync calls on the log. If used in conjuction with log.flush.interval.messages the log will be flushed when either criteria is met.
auto.create.topics.enable true Enable auto creation of topic on the server. If this is set to true then attempts to produce, consume, or fetch metadata for a non-existent topic will automatically create it with the default replication factor and number of partitions.
controller.socket.timeout.ms 30000 The socket timeout for commands from the partition management controller to the replicas.
controller.message.queue.size 10 The buffer size for controller-to-broker-channels
default.replication.factor 1 The default replication factor for automatically created topics.
replica.lag.time.max.ms 10000 If a follower hasn't sent any fetch requests for this window of time, the leader will remove the follower from ISR and treat it as dead.
replica.lag.max.messages 4000 If a replica falls more than this many messages behind the leader, the leader will remove the follower from ISR and treat it as dead.
replica.socket.timeout.ms 30 * 1000 The socket timeout for network requests to the leader for replicating data.
replica.socket.receive.buffer.bytes 64 * 1024 The socket receive buffer for network requests to the leader for replicating data.
replica.fetch.max.bytes 1024 * 1024 The number of byes of messages to attempt to fetch for each partition in the fetch requests the replicas send to the leader.
replica.fetch.wait.max.ms 500 The maximum amount of time to wait time for data to arrive on the leader in the fetch requests sent by the replicas to the leader.
replica.fetch.min.bytes 1 Minimum bytes expected for each fetch response for the fetch requests from the replica to the leader. If not enough bytes, wait up to replica.fetch.wait.max.ms for this many bytes to arrive.
num.replica.fetchers 1

Number of threads used to replicate messages from leaders. Increasing this value can increase the degree of I/O parallelism in the follower broker.

replica.high.watermark.checkpoint.interval.ms 5000 The frequency with which each replica saves its high watermark to disk to handle recovery.
fetch.purgatory.purge.interval.requests 10000 The purge interval (in number of requests) of the fetch request purgatory.
producer.purgatory.purge.interval.requests 10000 The purge interval (in number of requests) of the producer request purgatory.
zookeeper.session.timeout.ms 6000 Zookeeper session timeout. If the server fails to heartbeat to zookeeper within this period of time it is considered dead. If you set this too low the server may be falsely considered dead; if you set it too high it may take too long to recognize a truly dead server.
zookeeper.connection.timeout.ms 6000 The max time that the client waits to establish a connection to zookeeper.
zookeeper.sync.time.ms 2000 How far a ZK follower can be behind a ZK leader
controlled.shutdown.enable false Enable controlled shutdown of the broker. If enabled, the broker will move all leaders on it to some other brokers before shutting itself down. This reduces the unavailability window during shutdown.
controlled.shutdown.max.retries 3 Number of retries to complete the controlled shutdown successfully before executing an unclean shutdown.
controlled.shutdown.retry.backoff.ms 5000 Backoff time between shutdown retries.

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

分享到:
评论

相关推荐

    kafka-manager-2.0.0.2

    Ambari的kafka 配置kafka-manager。 CDH、开源也可以步骤一样。 kafka为开启kerberos认证的。 文章中用到的kafka-manager 适配绝大多数。 推荐使用!!!! kafka-manager作用: 管理多个集群 轻松检查群集状态...

    kafka-manager-2.0.0.2.zip

    6.删除topic(只支持0.8.2以上的版本并且要在broker配置中设置delete.topic.enable=true) 7.Topic list会指明哪些topic被删除(在0.8.2以上版本适用) 8.为已存在的topic增加分区 9.为已存在的topic更新配置 10....

    kafka_2.9.2-0.8.2.1.tgz

    kafka_2.9.2-0.8.2.1.tgz 安装 liunx环境 ... 2) 删除kafka存储目录(server.properties文件log.dirs配置,默认为"/tmp/kafka-logs")相关topic目录删除zookeeper "/brokers/topics/"目录下相关topic节点

    Kafka配置参数详解 - 网络技术.rar_KAFKA broker_Kafka配置参数详解_kafka

    每个kafka broker中配置文件server.properties必须配置的属性如下

    kafka-broker-charm

    TODO:提供高级用法,例如所需的配置或关系 发展 创建并激活具有开发要求的virtualenv: virtualenv -p python3 venv source venv/bin/activate pip install -r requirements-dev.txt 测验 Python运算符框架包括一...

    kafka-viz:一个简单的kafka可视化工具

    Kafka-Viz 一种快速轻松地运行、测试和可视化 kafka 的方法 先决条件 快速开始 启动zookeeper和kafka $ go install github....kafka broker 主机 KAFKA_PORT 9092 kafka 代理的端口 权限 电阻

    kafka-stream-practice:使用springboot进行kafka-stream的实际操作

    kafka流练习 这是使用spring-cloud-stream-...java -jar kafkastream-0.0.1-SNAPSHOT.jar --spring.cloud.stream.bindings.process-in-0.destination=<topic> --spring.cloud.stream.kafka.binder.brokers=<broker>

    node-red-contrib-kafkanode

    一些主题(请参阅)用法生产者节点参数: brokerUrl - Kafka 的 brokerUrl。 主题 -要生成的消息的主题。消费者节点参数: brokerUrl - Kafka 的 brokerUrl。 主题 -要生成的消息的主题。 GroupId -组 ID。Group ID...

    kafka中文文档broker配置参数

    NULL 博文链接:https://bewithme.iteye.com/blog/2395200

    knative-kafka-ch-backed-broker-load-test

    配置: 单个接收器,处理时间为10毫秒(10毫秒后响应202) 6个生成器,每个生成器每秒发送100条消息->定向发送的消息总数为600条消息/秒 已发送的邮件总数:1000 * 6 = 6000 结果: 消息发送花费了20秒-> 6000/...

    kafka--summary:kafka学习总结,源码剖析

    源码剖析目录一、基础篇开篇说明概念说明配置说明znode分类kafka协议分类Kafka线程日志存储格式kakfa架构设计二、流程篇1、kafka启动过程2、日志初始化和清理过程3、选举controller过程4、controller处理broker ...

    Kafka-Producer-Hello-World:用Java编写的Kafka生产者的基本示例

    卡夫卡制片人Hello World 用Java编写的Kafka生产者的基本示例。 更改BROKER_ADDR和TOPIC以匹配所需的Kafka配置。 默认值旨在通过将其作为VM运行来连接到Hortonworks沙箱。

    一个美观简洁且强大的kafka web管理工具

    主题创建、删除、扩容(删除需配置delete.topic.enable = true) broker状态监控 消费者组查看、删除 重置offset 消息查询(支持String和json方式展示) 发送消息(支持向指定的topic和partition发送字符串消息) ...

    logspout-kafka:Logspout适配器,用于将Docker容器日志写入Kafka主题

    "address": "kafka-broker1:9092,kafka-broker2:9092/container-logs"}'消息模板配置默认行为是将原始消息路由到Kafka。 该适配器提供了一种机制,用于通过KAFKA_TEMPLATE环境变量自定义模板以包含其他元数据。 ...

    prometheus-jmx-kafka:Kafka JMX配置文件

    Kafka JMX导出器配置 用于JMX导出器的Kafka度量标准配置文件( ) ...Description=Apache Kafka server (broker) Documentation=http://kafka.apache.org/documentation.html Requires=network.target remote-fs.

    kafka-security-playbook:Apache Kafka和Confluent平台的不同安全性配置示例

    卡夫卡安全手册该存储库包含一组docker映像,以演示Kafka和Confluent平台的安全...用法cd plain./upkafka-console-producer --broker-list kafka:9093 --producer.config /etc/kafka/consumer.properties --topic te

    kafka broker 常规配置参数

    kafka broker 常规配置 ----总结自《kafka 权威指南》 broker.id:broker 的标识符,默认为 0。可设置为任意整数,这个值在 kafka 集群里必须要是唯一的。 port:设置监听端口。如果使用 1024 以下的端口,...

    kafka-spring:kafa spring插件

    生产端连接配置,现支持配置broker的地址,系列化类,ack的次数等参数 com.gewara.kafka.producer.KafkaProducerTemplate:发送模板类,用于发送kafka信息 com.gewara.kafka.KafkaConsumerConnectionFactory:消费端...

    confluent-kafka-local:使用confluent-kafka的简单本地运行Apache Kafka实现

    有助于了解Zookeeper(配置)与Kafka Broker之间的通信。 要求 码头工人 Python 3.8以上 Python诗歌(测试所需) 我的 (可选) 发起 make run-kafka make install make test-produce make test-consume 预期的...

    connect-dns-provider:Kafka Connect的DNS配置提供程序

    Kafka Connect配置的DNS解析 这是一个小型库,可利用SRV类型的DNS记录来避免对Kafka Connect连接器配置中的服务器列表进行硬编码什么是SRV DNS记录? DNS最著名的记录类型是A和CNAME,这两种记录类型都使我们能够将...

Global site tag (gtag.js) - Google Analytics