Skip to content

Instantly share code, notes, and snippets.

@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)
@ram-pi
ram-pi / change_replication_factor.sh
Last active June 7, 2024 13:31
Change Replication Factor
#!/usr/bin/env bash
# Usage: change_replication_factor.sh <bootstrap-server> <broker-list> <blacklist-prefixes> <min-isr> <extra-var>
# Example: ./change_replication_factor.sh localhost:9092 1,2,3 _confluent,_schemas 2 --comment-config client.properties
# Example: export PATH=$PATH:/path/to/kafka/cli/bin ; ./change_replication_factor.sh localhost:9092 1,2,3 _confluent,_schemas 2 --comment-config client.properties
# Requires: jq, kafka-topics, kafka-reassign-partitions, kafka-configs
# Author: @ram-pi
# Version: 0.1
# Date: 2023-11-06
# Description: Change replication factor and min.insync.replicas for all topics in a Kafka cluster
@ram-pi
ram-pi / sr_clean.sh
Created October 30, 2023 15:19
Clear the Schema Registry of all the schemas.
#!/bin/bash
# ./sr_clean.sh https://myhost.confluent.cloud MY_KEY MY_SECRET ":."
echo "Schema Registry URL: $1"
echo "Subjects Prefix: $4"
SR_URL=$1
API_KEY=$2
API_SECRET=$3
@ram-pi
ram-pi / zook_grow.md
Created September 28, 2023 10:04 — forked from miketheman/zook_grow.md
Adding nodes to a ZooKeeper ensemble

Adding 2 nodes to an existing 3-node ZooKeeper ensemble without losing the Quorum

Since many deployments may start out with 3 nodes and so little is known about how to grow a cluster from 3 memebrs to 5 members without losing the existing Quorum, here is an example of how this might be achieved.

In this example, all 5 nodes will be running on the same Vagrant host for the purpose of illustration, running on distinct configurations (ports and data directories) without the actual load of clients.

YMMV. Caveat usufructuarius.

Step 1: Have a healthy 3-node ensemble