当前位置:   article > 正文

kafka的配置文件参数(server.properties)_kafka配置文件

kafka配置文件
[root@node2 config]# cat server.properties 

# broker的id,集群中必须唯一,按顺序来设置一个不重复的整数即可
broker.id=2

#监听地址和端口
#如果不设置,默认地址取java.net.InetAddress.getCanonicalHostName()的值,这个值其实就是localhost
# PLAINTEXT是监听器的名称,可以自定义,这里就保持它默认名称的即可
listeners=PLAINTEXT://192.168.118.133:9092


#将Broker的Listener信息发布到Zookeeper供客户端使用监听,是真正的对外代理地址。
#如果没有设置,会用listeners。外部连接访问这个,需要设置这个值
advertised.listeners=PLAINTEXT://192.168.118.133:9092

#将侦听器名称映射到安全协议,默认情况下它们是相同的
#listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL

# 服务器用于从网络接收请求并向网络发送响应的线程数
num.network.threads=3

# 服务器用于处理请求的io线程数
num.io.threads=8

# 发送缓冲区大小
socket.send.buffer.bytes=102400

# 接收缓冲区大小
socket.receive.buffer.bytes=102400

# 可以接受的最大请求大小(防止OOM)
socket.request.max.bytes=104857600


# 设置数据目录,一定要修改默认的目录
# kafka的消息都是以日志的形式保持的,所以这个数据目录将会越来越来
log.dirs=/opt/kafka_2.13-3.3.1/kafka-logs

# 一个topic默认的分区,在创建时可以指定topic分区,不指定则默认1个分区
# 多个分区有利于备份以及提高kafka效率
num.partitions=1

#每个数据目录用于启动时日志恢复和关闭时刷新的线程数。
num.recovery.threads.per.data.dir=1

 #不知道什么意思,根据提示设置合理的值吧,反正不能设置为1
# The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state"
# For anything other than development testing, a value greater than 1 is recommended to ensure availability such as 3.
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1



# 默认情况下消息是异步同步到文件系统的磁盘上的,下面有一些参数可以权衡
#    1. Durability: 如果不使用复制,未刷新的数据可能会丢失。
#    2. Latency: 过大的刷新间隔在发生刷新时可能会导致延迟峰值,因为需要刷新大量数据。
#    3. Throughput: 冲洗通常是最昂贵的操作,冲洗间隔过短可能导致过度的寻道。


# 每10000条消息则flush一次,即落盘,不管是否已经到了指定的时间间隔
#log.flush.interval.messages=10000

# 没1000ms消息就其中flush一次,即落盘,不管你有没有达到上面设置的消息条数
#log.flush.interval.ms=1000



# 多久删除消息数据文件,默认168小时,即7天
log.retention.hours=168

# A size-based retention policy for logs. Segments are pruned from the log unless the remaining
# segments drop below log.retention.bytes. Functions independently of log.retention.hours.
#log.retention.bytes=1073741824

# 一个segment文件的最大大小,当达到设置的值后将产生新的segment文件,默认是1GB
log.segment.bytes=1073741824

# 根据日志报存策略,周期性的检查日志数据是否可以删除,默认300000ms,即5分钟检查一下是否可以删除
#每个Kafka broker启动时,都会在后台开启一个定时任务,定期地去检查并执行所有topic日志留存
log.retention.check.interval.ms=300000



# 要连接的zookeeper集群
# 多个参数直接使用,号相隔开,可以将可选的chroot字符串附加到url中,以指定
#所有kafka znode的根目录,如"127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/kafka".
zookeeper.connect=192.168.118.131:2181,192.168.118.132:2181,192.168.118.133:2181

# kafka连接到zookeeper的超时时间,单位ms
zookeeper.connection.timeout.ms=18000


############################# Group Coordinator Settings #############################
#提示设置为3,那就设置为3
# The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance.
# 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.
# The default value for this is 3 seconds.
# We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.
# 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.
group.initial.rebalance.delay.ms=0
[root@node2 config]# 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/825348
推荐阅读
相关标签
  

闽ICP备14008679号