# Licensed to the Apache Software Foundation (ASF) under one or more
# 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.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.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 org.apache.kafka.clients.producer.ProducerConfig for more details ############################# Producer Basics ############################# # list of brokers used for bootstrapping knowledge about the rest of the cluster
# format: host1:port1,host2:port2 ...
#bootstrap.servers=localhost:9092 # specify the compression codec for all data generated: none, gzip, snappy, lz4, zstd
#compression.type=none # name of the partitioner class for partitioning events; default partition spreads data randomly
#partitioner.class= # the maximum amount of time the client will wait for the response of a request
#request.timeout.ms= # how long `KafkaProducer.send` and `KafkaProducer.partitionsFor` will block for
#max.block.ms= # the producer will wait for up to the given delay to allow other records to be sent so that the sends can be batched together
#linger.ms= # the maximum size of a request in bytes
#max.request.size= # the default batch size in bytes when batching multiple records sent to a partition
#batch.size= # the total bytes of memory the producer can use to buffer records waiting to be sent to the server
#buffer.memory= #指定kafka节点列表,用于获取metadata,不必全部指定
metadata.broker.list=192.168.142.145:9092,192.168.142.146:9092,192.168.142.147:9092 #指定分区处理类。默认kafka.producer.DefaultPartitioner,表示通过key哈希到对应分区
#partitioner.class=kafka.producer.DefaultPartitioner #是否压缩,默认0表示不压缩,1表示gzip压缩,2表示snappy压缩,压缩后消息中会有头来指明消息压缩类型,故在消费者端消息解压是透明的无需指定。
compression.codec=none #指定序列化处理类
serializer.class=kafka.serializer.DefaultEncoder #如果要压缩消息,这里指定那些topic要压缩消息,默认empty,表示不压缩。
#compressed.topics= #设置发送数据是否需要服务端的反馈,有三个值0,1,-1
#0:producer不会等待broker发送ack
#1:当leader接收到消息之后发送ack
#-1:当所有的follower都同步消息成功后发送ack
request.required.acks=0 #在向producer发送ack之前,broker允许等待的最大时间,如果超时,broker将会向producer发送一个error ack,意味着上一次消息因为某种原因未能成功(比如followers未能同步成功)
request.timeout.ms=10000 #同步还是异步发送消息,默认"sync"表同步,"async"表异步,异步可以提高发送吞吐量,也意味着消息将会在本地buffer中,并适时批量发送,但是也可能导致丢失未发送过去的消息
producer.type=sync #在async模式下,当message被缓存的时间超过此值后,将会批量发送给broker,默认为5000ms
#此值和batch.num.messages协同工作
queue.buffering.max.ms=5000 #在async模式下,producer端允许buffer的最大消息量
#无论如何,producer都无法尽快的将消息发送给broker,从而导致在producer端大量沉积
#此时,如果消息的条数达到阀值,将会导致producer端阻塞或者消息被抛弃,默认为10000
queue.buffering.max.messages=20000 #如果是异步,指定每次批量发送数据量,默认为200
batch.num.messages=500 #当消息在producer端沉积的条数达到"queue.buffering.max.messages"后
#阻塞一定时间后,队列任然没有enqueue(producer任然没有发送任何消息)
#此时producer可以继续阻塞或者将消息抛弃,此timeout值用于控制"阻塞"的时间
#-1:无阻塞超时限制,消息不会被抛弃
#0:立即清空队列,消息被抛弃
queue.enqueue.timeout.ms=-1

  

kafka-producer.properties的更多相关文章

  1. 在kafka/config/目录下面有3个配置文件参数说明(producer.properties。consumer.properties。server.properties)

    (1).producer.properties:生产端的配置文件 #指定kafka节点列表,用于获取metadata,不必全部指定 #需要kafka的服务器地址,来获取每一个topic的分片数等元数据 ...

  2. kafka producer源码

    producer接口: /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor l ...

  3. kafka producer生产数据到kafka异常:Got error produce response with correlation id 16 on topic-partition...Error: NETWORK_EXCEPTION

      kafka producer生产数据到kafka异常:Got error produce response with correlation id 16 on topic-partition... ...

  4. kafka producer 0.8.2.1 示例

    package test_kafka; import java.util.Properties; import java.util.concurrent.atomic.AtomicInteger; i ...

  5. 关于Kafka producer管理TCP连接的讨论

    在Kafka中,TCP连接的管理交由底层的Selector类(org.apache.kafka.common.network)来维护.Selector类定义了很多数据结构,其中最核心的当属java.n ...

  6. Kafka Producer接口

    参考, https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+Producer+Example http://kafka.apache.org ...

  7. kafka producer自定义partitioner和consumer多线程

    为了更好的实现负载均衡和消息的顺序性,Kafka Producer可以通过分发策略发送给指定的Partition.Kafka Java客户端有默认的Partitioner,平均的向目标topic的各个 ...

  8. Kafka producer拦截器(interceptor)

    Kafka producer拦截器(interceptor) 拦截器原理 Producer拦截器(interceptor)是在Kafka 0.10版本被引入的,主要用于实现clients端的定制化控制 ...

  9. 详解Kafka Producer

    上一篇文章我们主要介绍了什么是 Kafka,Kafka 的基本概念是什么,Kafka 单机和集群版的搭建,以及对基本的配置文件进行了大致的介绍,还对 Kafka 的几个主要角色进行了描述,我们知道,不 ...

  10. Apache Kafka Producer For Beginners

    在我们上一篇Kafka教程中,我们讨论了Kafka Cluster.今天,我们将通过示例讨论Kafka Producer.此外,我们将看到KafkaProducer API和Producer API. ...

随机推荐

  1. Oracle 数据库优化

    Oracle 数据库优化 参考网址

  2. oracle blob 反序列化错误

    代码的目的是先将一个配置类JobConfig序列化存进Oracle中的Blob中,然后查的时候反序列化出来. 先看一下控制台报错 ### Cause: com.audaque.lib.core.exc ...

  3. iframe的基础应用

    点击top.html里面的按钮,刷新left.html右边的内容 <a href="left.html?id=11111&k=5&b=4"  target=& ...

  4. Android深度探索-卷1第九章心得体会

    在android系统中使用Linux 驱动有两种方式一种是通过传统的方式直接与Lmux 驱动交互,如,直接读写设备文件的数据.另外一种是Android特有的,就是通过HAL 模块.HAL 模块本质是通 ...

  5. Java8数据流

    流/Stream是在JAVA8中引入的一个抽象,可以处理类似SQL语句声明数据. 例如,考虑下面的SQL语句. SELECT max(salary),employee_id,employee_name ...

  6. mysql解析json字符串相关问题

    很多时候,我们需要在sql里面直接解析json字符串.这里针对mysql5.7版本的分水岭进行区分. 1.对于mysql5.7以上版本 使用mysql的内置函数JSON_EXTRACT(column, ...

  7. 命令行打包war包

    输入jar -cvf  包名.war  目录/*

  8. POJ-1679.The Unique MST.(Prim求次小生成树)

    The Unique MST Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 39561   Accepted: 14444 ...

  9. 清除mac中自动记录的git用户名和密码

    应用程序-实用工具-双击钥匙串-右上角搜索github-右击选项删除

  10. 图标,空格,大小尖括号,段落,换行,标题,div白板,span白板

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...