Kafka useful commands
for topic in $(find /opt/cloudera/data/*/kafka/ -maxdepth 1 -mindepth 1 -type d -exec basename {} \;| awk -F '-' '{print $1}'| sort |uniq | grep -v consumer_offsets);do
du -csh /opt/cloudera/data/*/kafka/${topic}*| grep total| awk '{print "topic '$topic' "$1}'
done
kafka-configs --describe --zookeeper hdp-m-01:2181,hdp-m-02:2181,hdp-m-03:2181/kafka --entity-type topics --entity-name adrequests
kafka-configs --describe --zookeeper hdp-m-01:2181,hdp-m-02:2181,hdp-m-03:2181/kafka --entity-type topics
kafka-topics --create --zookeeper hdp-m-01:2181,hdp-m-02:2181,hdp-m-03:2181/kafka --replication-factor 3 --partitions 50 evnt_v1_rtb
kafka-topics --delete --zookeeper hdp-m-01:2181,hdp-m-02:2181,hdp-m-03:2181/kafka --topic events_adreqs
# 1 day = 86400000, 7 day = 604800000
kafka-topics --zookeeper hdp-m-01:2181,hdp-m-02:2181,hdp-m-03:2181/kafka --alter --topic evnt_v1_areq --config retention.ms=21600000
kafka-topics --describe --zookeeper hdp-m-01:2181,hdp-m-02:2181,hdp-m-03:2181/kafka evnt_v1_opps
kafka-topics --list --zookeeper hdp-m-01:2181/kafka
kafka-topics --describe --zookeeper hdp-m-01:2181,hdp-m-02:2181,hdp-m-03:2181/kafka
kafka-console-consumer evnt_v1_imprs --zookeeper hdp-m-01:2181/kafka
timeout 30 kafka-console-consumer evnt_v1_opps --zookeeper hdp-m-01:2181/kafka 2>&1 | grep hostname | jq 'select(.network_id == null)'
https://archive.cloudera.com/kafka/kafka/2/kafka-0.9.0-kafka2.0.1/ops.html
http://www.allprogrammingtutorials.com/tutorials/configuring-messages-retention-time-in-kafka.php