Skip to content

Instantly share code, notes, and snippets.

View srimaln91's full-sized avatar
🎯
Focusing

Srimal Nishantha srimaln91

🎯
Focusing
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)
@srimaln91
srimaln91 / routes.sh
Created October 15, 2022 17:58
Enable internet sharing in the local network
# ! /bin/bash
# Share internet connection
# enxfcde56ff0106 -> interface which has an internet connection
# enp1s0 -> Interface which has connected to the network that we have to share the internet
# 192.168.100.0/24 -> local subnet
# Please replace the above values/interaces with the ones you have in your computer
sudo iptables -A FORWARD -o enxfcde56ff0106 -i enp1s0 -s 192.168.100.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -F POSTROUTING
@srimaln91
srimaln91 / auto_increment_usage.sql
Created July 15, 2022 04:48
Find out the usage of MySQL auto increment fields
SELECT
TABLE_SCHEMA,
TABLE_NAME,
COLUMN_NAME,
DATA_TYPE,
COLUMN_TYPE,
IF(
LOCATE('unsigned', COLUMN_TYPE) > 0,
1,
0
@srimaln91
srimaln91 / tombstone.sh
Created June 20, 2022 08:04
Apache Kafka - Producng Tombstone record using KafkaCat
echo "key:" | kafkacat -b <broker1,broker2> -t <topic> -p <partition> -Z -K: -e
@srimaln91
srimaln91 / gitlab-runner.sh
Created September 27, 2021 17:13
Setup Gitlab Runner - Docker
apt install docker.io
docker volume create gitlab-runner-config
docker run -d --name gitlab-runner --restart always -v /var/run/docker.sock:/var/run/docker.sock -v gitlab-runner-config:/etc/gitlab-runner gitlab/gitlab-runner:latest
docker run --rm -it -v gitlab-runner-config:/etc/gitlab-runner gitlab/gitlab-runner:latest register
@srimaln91
srimaln91 / docker-compose.yml
Last active September 6, 2021 18:14
Docker compose file for Kafka, Zookeeper, Confluent Schema Registry
---
version: '2'
services:
zookeeper:
container_name: zookeeper
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
@srimaln91
srimaln91 / rocksdb_centos.sh
Created March 3, 2021 12:00
Install RocksDB in CentOS7
#!/bin/bash
set -ex
ROCKSDB_VERSION="5.18.4"
ZSTD_VERSION="1.1.3"
yum update -y && yum install epel-release -y
yum install -y \
wget \
@srimaln91
srimaln91 / node-exporter.sh
Created February 1, 2021 16:23
Setup node exporer in Debian/RedHat based Linux systems
#!/bin/bash
#Run as a root user
if [ "$EUID" -ne 0 ]
then echo "Please run as root (with sudo command)"
exit
fi
#Colours
GREEN='\e[32m'
@srimaln91
srimaln91 / reset-grafana-password.sh
Created January 20, 2021 19:13
Reset Grafana admin password in Docker container
docker exec -ti <container_name> grafana-cli admin reset-admin-password --homepath /usr/share/grafana mypass@123
@srimaln91
srimaln91 / etcd_admin.sh
Created January 18, 2021 12:22
ETCD User/Role Management Commands
ETCD User/Role Management Commands
# Users
etcdctl --endpoints {etcd_host}:2379 --user root --password {pass} user list
etcdctl --endpoints {etcd_host}:2379 --user root --password {pass} user add <user_name>
# Roles
etcdctl --endpoints {etcd_host}:2379 --user root --password {pass} role list
etcdctl --endpoints {etcd_host}:2379 --user root --password {pass} role add {role_name}
etcdctl --endpoints {etcd_host}:2379 --user root --password {pass} role grant-permission {role_name} --prefix=true read /system/delivery-services/