Anybody could help to answer this question? Thanks!
From: ZHU Hua B
Sent: 2016年10月14日 16:41
Subject: [COMMERCIAL] A question about kafka
I have a question about kafka, could you please help to have a look?
I want to send a message from producer with snappy compression codec. So I run
the command "bin/kafka-console-producer.sh --compression-codec snappy
--broker-list localhost:9092 --topic test", after that I checked the data log,
compresscodec is SnappyCompressionCodec as expectation.
Then I tried another command "bin/kafka-console-producer.sh --producer-property
compression.type=snappy --broker-list localhost:9092 --topic test" to send a
message from producer with snappy also, but this time I found compresscodec is
NoCompressionCodec in data log.
I double checked the option of "kafka-console-producer.sh" as below, seems both
"--compression-codec" and "--producer-property" could be used to set up
compression codec, why the second way failed? The "key=value" I found in
config/producer.properties, so I think it is regular. Thanks!
# bin/kafka-console-producer.sh --help
--compression-codec [compression-codec] The compression codec: either
'none','gzip', 'snappy', or 'lz4'.If specified without value, then it defaults
--producer-property <producer_prop> A mechanism to pass user-defined
properties in the form key=value to the producer.
--producer.config <config file> Producer config properties file. Note
that [producer-property] takes precedence over this config.