kafka生产服务器配置

原创
半兽人 发表于: 2015-03-10   最后更新时间: 2021-08-12 14:23:01  
{{totalSubscript}} 订阅, 26,669 游览

新版

生产者服务器配置

Here is our server production server configuration:
这是我们的服务器生产服务器配置:

# ZooKeeper
zookeeper.connect=[list of ZooKeeper servers]

# Log configuration
num.partitions=8
default.replication.factor=3
log.dir=[List of directories. Kafka should have its own dedicated disk(s) or SSD(s).]

# Other configurations
broker.id=[An integer. Start with 0 and increment by 1 for each new broker.]
listeners=[list of listeners]
auto.create.topics.enable=false
min.insync.replicas=2
queued.max.requests=[number of concurrent requests]

Our client configuration varies a fair amount between different use cases.
我们的客户配置在不同的使用情况下有相当大的差异。

旧版

生产者服务器配置

Here is our server production server configuration:
这是我们的服务器生产服务器配置:

# Replication configurations
num.replica.fetchers=4
replica.fetch.max.bytes=1048576
replica.fetch.wait.max.ms=500
replica.high.watermark.checkpoint.interval.ms=5000
replica.socket.timeout.ms=30000
replica.socket.receive.buffer.bytes=65536
replica.lag.time.max.ms=10000
replica.lag.max.messages=4000

controller.socket.timeout.ms=30000
controller.message.queue.size=10

# Log configuration
num.partitions=8
message.max.bytes=1000000
auto.create.topics.enable=true
log.index.interval.bytes=4096
log.index.size.max.bytes=10485760
log.retention.hours=168
log.flush.interval.ms=10000
log.flush.interval.messages=20000
log.flush.scheduler.interval.ms=2000
log.roll.hours=168
log.retention.check.interval.ms=300000
log.segment.bytes=1073741824

# ZK configuration
zookeeper.connection.timeout.ms=6000
zookeeper.sync.time.ms=2000

# Socket server configuration
num.io.threads=8
num.network.threads=8
socket.request.max.bytes=104857600
socket.receive.buffer.bytes=1048576
socket.send.buffer.bytes=1048576
queued.max.requests=16
fetch.purgatory.purge.interval.requests=100
producer.purgatory.purge.interval.requests=100

Our client configuration varies a fair amount between different use cases.
我们的客户端根据不同的使用情况调整数量。

更新于 2021-08-12
在线,2小时前登录

松赞干布 2年前

为什么不设置log.retenttion.bytes呢,不害怕流量激增超过磁盘上限吗?

半兽人 -> 松赞干布 2年前

1、一般服务器都会预留足够的空间的,比如你默认7天清理,那实际你的磁盘配置是满足10-15天的量的。
2、通常情况下,kafka的数据是会被离线系统随时取走进行分析的,如果一旦你的业务根据存储阈值来清理日志,因为每个分区的日志量不一样,有的大有的小,有的重要有的不重要,重要的数据量没那么大,反而被清理了,这是业务层不想看到的,会干扰结果(因为你不知道是被清理了,还是根本就没有数据)

所以通常会预留*2的存储空间,减少不必要的麻烦。

松赞干布 -> 半兽人 2年前

您的考虑确实很有道理,谢谢解答

瓦尔登湖畔 4年前

1.0.0版本kafka,单机3节点,128G内存。

问题:kafka运行一两天,服务就自己停了。找不到原因,请问该从何入手排查?

之前的启动命令,大概一两天服务就停了:

bin/kafka-server-start.sh  ./config/server.properties  &

今天启动用的命令:

bin/kafka-server-start.sh -daemon ./config/server.properties  &

以上,烦请解答,谢谢。

你不是守护进程启动的。

nohub bin/kafka-server-start.sh ./config/server.properties &

这样就可以了。

嗯嗯,上午启动到现在还没问题,我再观察一下,记得之前没遇到过这种情况。

正常了吧。

我昨天用daemon + &启动的,到目前为止服务正常。
我是看文档上直接用&后台启的,感谢。

独爱一篇文 4年前

您好,这个是哪个配置文件呀

这个配置是客户端的命令行示例中指向的配置文件producer.properties,如:

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test --producer.config config/producer.properties
Tlink 4年前

这个是完整的配置吗?

半兽人 -> Tlink 4年前

嗯。0.10.x版本的

... 6年前

官方文档没看到这样的配置,是站长公司生产服务器配置吗?可以简要介绍下生产环境服务器的硬件配置吗

半兽人 -> ... 6年前

有的,是之前的文档,新文档缩减了。叫:A Production Server Config

... -> 半兽人 6年前

嗯,查了,0.10.x版本有这个配置,3Q

查看kafka更多相关的文章或提一个关于kafka的问题,也可以与我们一起分享文章