Skip to content

Instantly share code, notes, and snippets.

@ram-pi
ram-pi / docker-compose.yaml
Last active September 26, 2024 12:04
Connect on Docker with Kafka on CCloud
---
services:
kafka-connect:
image: confluentinc/cp-server-connect:7.7.1
hostname: kafka-connect
container_name: kafka-connect
healthcheck:
test: curl -fail --silent http://kafka-connect-1:8083/connectors --output /dev/null || exit 1
interval: 10s
@ram-pi
ram-pi / pom.xml
Created September 24, 2024 12:41
Kafka Client - pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.rampi</groupId>
<artifactId>kafka-client-example</artifactId>
<version>1.0-SNAPSHOT</version>
@ram-pi
ram-pi / change_replication_factor.sh
Last active November 21, 2024 13:36
Change replication factor script
#!/usr/bin/env bash
# Usage: change_replication_factor.sh <bootstrap-server> <broker-list> <topic-file> <replication-factor> <min-isr> <extra-var>
# Example: ./change_replication_factor.sh localhost:9092 1,2,3 /tmp/topic.txt 3 2 --command-config client.properties
# Example: export PATH=$PATH:/path/to/kafka/cli/bin ; ./change_replication_factor.sh localhost:9092 1,2,3 /tmp/topic.txt 3 2 --command-config client.properties
# Requires: jq, kafka-topics, kafka-reassign-partitions, kafka-configs
# Author: @ram-pi
# Version: 0.3
# Date: 2024-11-21
# Description: Change replication factor and min.insync.replicas for topics defined in a file
@ram-pi
ram-pi / ca_validation.md
Created July 16, 2024 11:28 — forked from genaromadrid/ca_validation.md
Validate a Certificate against a Certificate Authority using OpenSSL

Certificate CA Validation

The easy way

To validate a certificate agains a certificate authority you just have to run

openssl verify -trusted ca_root.pem -untrusted intermediate_ca.pem certificate.pem

You'll see a 'OK' message at the end of the output

@ram-pi
ram-pi / offsets_mover.sh
Created March 29, 2024 14:49
Script for moving offset from one cluster to another
#!/usr/bin/env bash
# example usage: ./offsets_mover.sh localhost:9092 client.1.properties localhost:9093 client.2.properties
# get bootstrap servers from args
BOOTSTRAP_SERVER=$1
# get properties file location from args
PROPERTIES_FILE=$2
@ram-pi
ram-pi / ips.sh
Created March 29, 2024 08:27
Get IPs from all groups with kafka-consumer-group cli
#!/usr/bin/env bash
# example usage: ./ips.sh localhost:9092 /etc/kafka/consumer.properties
# get bootstrap servers from args
BOOTSTRAP_SERVER=$1
# get properties file location from args
PROPERTIES_FILE=$2
@ram-pi
ram-pi / README.md
Created February 23, 2024 15:06 — forked from dnozay/README.md
Enable memberOf attribute on an openldap server.
@ram-pi
ram-pi / run.sh
Last active January 18, 2024 16:26
Confluent Cloud - Failover all mirror topics
#!/usr/bin/env bash
# This script is used to failover all the mirror topics from one link to another
# Usage: ./run.sh <link_id>
# Example: ./run.sh link2
# prerequisites:
# - install jq
# - install confluent cli
# - login to confluent cloud using "confluent login" and select the environment and cluster with "confluent env use xxx" and "confluent kafka cluster use xxx
@ram-pi
ram-pi / Program.cs
Created January 12, 2024 18:46
dotnet txn-producer
using System;
using Confluent.Kafka;
class Program
{
public static void Main(string[] args)
{
var conf = new ProducerConfig {
BootstrapServers = "localhost:9092",
SecurityProtocol = SecurityProtocol.SaslPlaintext,
@ram-pi
ram-pi / udp_stress_client.py
Created November 9, 2023 16:05
UDP traffic generator
from socket import socket, AF_INET, SOCK_DGRAM
import time
import sys
host = "localhost"
port = 10514
UDPSock = socket(AF_INET, SOCK_DGRAM)