Skip to content

Instantly share code, notes, and snippets.

@fjbsantiago
Last active March 27, 2019 07:17
Show Gist options
  • Save fjbsantiago/0eb478cbbd49c63627551e4e8d0a31c2 to your computer and use it in GitHub Desktop.
Save fjbsantiago/0eb478cbbd49c63627551e4e8d0a31c2 to your computer and use it in GitHub Desktop.
Kafka Tips
#
# Get 1 single record from topic by partition Nr and Offset Nr
#
# Hint 1: Execute using running schema-registry container
# Hint 2: If possible, stop any producers that might cause kafka to delete or tombstone records in this topic (don't really know if tombstone records become inaccessible, but... just to be sure)
#
docker exec -it schema-registry kafka-avro-console-consumer --bootstrap-server localhost:9092 --topic topic-name --max-messages 1 --property print.key=true --offset 71403579 --partition 1
kafka-run-class kafka.admin.ConsumerGroupCommand \
--group kafka-connect \
--bootstrap-server localhost:9092 \
--describe
kafka-run-class kafka.tools.ConsumerOffsetChecker \
--topic my-topic \
--zookeeper localhost:2181 \
--group kafka-connect
// Print first message and key from topic
docker exec -it schema-registry kafka-avro-console-consumer \
--bootstrap-server localhost:9092 \
--topic my-topic \
--key-deserializer org.apache.kafka.common.serialization.StringDeserializer \
--from-beginning \
--max-messages 1 \
--property print.key=true
kafka-topics --describe --zookeeper localhost:2181 --topic my-topic
docker exec -it kafka kafka-topics \
-- alter \
--zookeeper localhost:2181 \
--topic my-topic \
docker exec -it kafka kafka-topics \
--bootstrap-server kafka- \
--entity-type brokers \
--entity-name 0 \
--alter \
--add-config log.segment.bytes=200000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment