kafka-producer.properties
3.1 KB
#\u6d4b\u8bd5\u73af\u5883
metadata.broker.list=120.76.65.235:9092,120.76.76.90:9092,120.76.43.202:9092
#metadata.broker.list=10.47.32.86:9092,10.47.36.217:9092,10.47.32.65:9092,10.47.40.205:9092,10.47.37.105:9092,10.47.40.17:9092,10.47.33.69:9092
##\u6d88\u606f\u538b\u7f29\u7b97\u6cd5,none,gzip,snappy
compression.codec=none
request.required.acks=1
serializer.class=com.sibu.directSale.kafka.BeanSerializer
partitioner.class=com.sibu.directSale.kafka.MessagePartitioner
key.serializer.class=kafka.serializer.StringEncoder
# \u540c\u6b65\u8fd8\u662f\u5f02\u6b65\u53d1\u9001\u6d88\u606f\uff0c\u9ed8\u8ba4\u201csync\u201d\u8868\u540c\u6b65\uff0c"async"\u8868\u5f02\u6b65\u3002\u5f02\u6b65\u53ef\u4ee5\u63d0\u9ad8\u53d1\u9001\u541e\u5410\u91cf,
# \u4e5f\u610f\u5473\u7740\u6d88\u606f\u5c06\u4f1a\u5728\u672c\u5730buffer\u4e2d,\u5e76\u9002\u65f6\u6279\u91cf\u53d1\u9001\uff0c\u4f46\u662f\u4e5f\u53ef\u80fd\u5bfc\u81f4\u4e22\u5931\u672a\u53d1\u9001\u8fc7\u53bb\u7684\u6d88\u606f
producer.type=async
############## \u5f02\u6b65\u53d1\u9001 (\u4ee5\u4e0b\u56db\u4e2a\u5f02\u6b65\u53c2\u6570\u53ef\u9009) ####################
# \u5728async\u6a21\u5f0f\u4e0b,\u5f53message\u88ab\u7f13\u5b58\u7684\u65f6\u95f4\u8d85\u8fc7\u6b64\u503c\u540e,\u5c06\u4f1a\u6279\u91cf\u53d1\u9001\u7ed9broker,\u9ed8\u8ba4\u4e3a5000ms
# \u6b64\u503c\u548cbatch.num.messages\u534f\u540c\u5de5\u4f5c.
queue.buffering.max.ms = 5000
# \u5728async\u6a21\u5f0f\u4e0b,producer\u7aef\u5141\u8bb8buffer\u7684\u6700\u5927\u6d88\u606f\u91cf
# \u65e0\u8bba\u5982\u4f55,producer\u90fd\u65e0\u6cd5\u5c3d\u5feb\u7684\u5c06\u6d88\u606f\u53d1\u9001\u7ed9broker,\u4ece\u800c\u5bfc\u81f4\u6d88\u606f\u5728producer\u7aef\u5927\u91cf\u6c89\u79ef
# \u6b64\u65f6,\u5982\u679c\u6d88\u606f\u7684\u6761\u6570\u8fbe\u5230\u9600\u503c,\u5c06\u4f1a\u5bfc\u81f4producer\u7aef\u963b\u585e\u6216\u8005\u6d88\u606f\u88ab\u629b\u5f03\uff0c\u9ed8\u8ba4\u4e3a10000
queue.buffering.max.messages=10000
# \u5982\u679c\u662f\u5f02\u6b65\uff0c\u6307\u5b9a\u6bcf\u6b21\u6279\u91cf\u53d1\u9001\u6570\u636e\u91cf\uff0c\u9ed8\u8ba4\u4e3a200
batch.num.messages=200
# \u5f53\u6d88\u606f\u5728producer\u7aef\u6c89\u79ef\u7684\u6761\u6570\u8fbe\u5230"queue.buffering.max.meesages"\u540e
# \u963b\u585e\u4e00\u5b9a\u65f6\u95f4\u540e,\u961f\u5217\u4ecd\u7136\u6ca1\u6709enqueue(producer\u4ecd\u7136\u6ca1\u6709\u53d1\u9001\u51fa\u4efb\u4f55\u6d88\u606f)
# \u6b64\u65f6producer\u53ef\u4ee5\u7ee7\u7eed\u963b\u585e\u6216\u8005\u5c06\u6d88\u606f\u629b\u5f03,\u6b64timeout\u503c\u7528\u4e8e\u63a7\u5236"\u963b\u585e"\u7684\u65f6\u95f4
# -1: \u65e0\u963b\u585e\u8d85\u65f6\u9650\u5236,\u6d88\u606f\u4e0d\u4f1a\u88ab\u629b\u5f03
# 0:\u7acb\u5373\u6e05\u7a7a\u961f\u5217,\u6d88\u606f\u88ab\u629b\u5f03
queue.enqueue.timeout.ms=-1
##\u5f53producer\u63a5\u6536\u5230error ACK,\u6216\u8005\u6ca1\u6709\u63a5\u6536\u5230ACK\u65f6,\u5141\u8bb8\u6d88\u606f\u91cd\u53d1\u7684\u6b21\u6570
##\u56e0\u4e3abroker\u5e76\u6ca1\u6709\u5b8c\u6574\u7684\u673a\u5236\u6765\u907f\u514d\u6d88\u606f\u91cd\u590d,\u6240\u4ee5\u5f53\u7f51\u7edc\u5f02\u5e38\u65f6(\u6bd4\u5982ACK\u4e22\u5931)
##\u6709\u53ef\u80fd\u5bfc\u81f4broker\u63a5\u6536\u5230\u91cd\u590d\u7684\u6d88\u606f.
message.send.max.retries=3