checking kafka data if compressed -
the document said add line compression.codec=gzip in producer.properties make message compressed.
when open data file such as: 0000000000000.log found data not compressed. how should check whether data in kafka compressed already? p.s: every testing stop kafka cluster , zookeeper , deleted of data in kafka-logs , zookeeper,then start server again , create new topic.
the java producerconfig class has changed config.
public static final string compression_type_config = "compression.type"; i've produced messages java client (0.8.2.1) using producerconfig.compression_type_config , works fine.
example:
props.put(producerconfig.compression_type_config, "gzip"); or set compression.type=gzip in server.properties file java client.
update cli tool
read usage command line tools:
chrisblack:kafka:% ./bin/kafka-console-producer.sh ... --compression-codec [compression-codec] compression codec: either 'none', 'gzip', 'snappy', or 'lz4'.if specified without value, defaults 'gzip' ... --new-producer use new producer implementation. --producer-property <producer_prop> mechanism pass user-defined properties in form key=value producer. --property <prop> mechanism pass user-defined properties in form key=value message reader. allows custom configuration user- defined message reader. ... try running similar command shell:
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test_compression --compression-codec
Comments
Post a Comment