Skip to content

Instantly share code, notes, and snippets.

View maheshkumargangula's full-sized avatar

Mahesh Kumar Gangula maheshkumargangula

View GitHub Profile

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
@maheshkumargangula
maheshkumargangula / kafka-cheat-sheet.md
Created January 9, 2020 04:44 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

[root@kafka-a-01 /]# /opt/kafka_current/bin/kafka-console-consumer.sh
The console consumer is a tool that reads data from Kafka and outputs it to standard output.
Option Description
------ -----------
--blacklist <blacklist> Blacklist of topics to exclude from
consumption.
--bootstrap-server <server to connect REQUIRED (unless old consumer is
to> used): The server to connect to.
--consumer-property <consumer_prop> A mechanism to pass user-defined
properties in the form key=value to
# Clean webapps, logs folders.
rm -rf ~/Tools/apache-tomcat-8.0.36/webapps/learning-service*
rm -rf ~/Tools/apache-tomcat-8.0.36/logs/*
rm -rf /data/logs/*
# To list images
docker images
# To list containers
docker ps -s
# To build Dockerfile
docker build -f Dockerfile . -t mahesh/nginx
# To run inline.
@maheshkumargangula
maheshkumargangula / app.js
Last active August 29, 2015 14:27 — forked from benlesh/app.js
Angular - Basics of Unit Testing a Controller
var app = angular.module('myApp', []);
/* Set up a simple controller with a few
* examples of common actions a controller function
* might set up on a $scope. */
app.controller('MainCtrl', function($scope, someService) {
//set some properties
$scope.foo = 'foo';
$scope.bar = 'bar';