Skip to content

Instantly share code, notes, and snippets.

View millerjp's full-sized avatar

Johnny Miller millerjp

View GitHub Profile
@millerjp
millerjp / cassandra-hotkey-replica-check.sh
Last active September 2, 2026 15:15
cassandra-hotkey-replica-check.sh
#!/usr/bin/env bash
#
# cassandra-hotkey-replica-check.sh (AxonOps)
#
# Read-only Cassandra diagnostic: map a cluster's tracked "hot" partitions
# to their replica sets, to test whether a set of misbehaving nodes is
# simply the replica set of the hottest keys.
#
# Requires Cassandra 4.1+ with top-partition tracking active (it is by
# default: top_partitions_enabled=true).
@millerjp
millerjp / cassandra-diag-collect.sh
Last active September 2, 2026 15:16
Read-only diagnostics collector for a running Apache Cassandra node (JVM, nodetool, OS level). Zero-impact by default, no heap dumps. Read and understand before running.
#!/usr/bin/env bash
#
# Copyright 2026 AxonOps (https://axonops.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@millerjp
millerjp / restore_snapshots.sh
Last active March 28, 2026 07:36
Restores Cassandra table data from auto-snapshots created when tables were dropped
#!/usr/bin/env bash
#
# restore_snapshots.sh
#
# Restores Cassandra table data from auto-snapshots created when tables were
# dropped (auto_snapshot: true). Assumes tables have already been recreated
# with the same schema.
#
# What this does:
# 1. Finds old table directories containing dropped-* snapshots
@millerjp
millerjp / lwt_timing_reproduction_python.py
Created January 3, 2026 07:51
Cassandra 5.0.6 DELETE requires delay after INSERT IF NOT EXISTS (python example)
#!/usr/bin/env python3
"""
LWT Paxos Timing Issue - Comprehensive Reproduction (Python)
Demonstrates that DELETE after INSERT IF NOT EXISTS requires a delay
for Paxos consensus to complete.
To run:
python3 lwt_timing_reproduction_python.py
@millerjp
millerjp / lwt_timing_reproduction_go.go
Last active January 3, 2026 07:49
Cassandra 5.0.6 DELETE requires delay after INSERT IF NOT EXISTS (go example)
// LWT Paxos Timing Issue - Comprehensive Reproduction (Go)
//
// Demonstrates that DELETE after INSERT IF NOT EXISTS requires a delay
// for Paxos consensus to complete.
//
// To run:
// go run lwt_timing_reproduction_go.go
//
// Prerequisites:
// - Cassandra running on 127.0.0.1:9042

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@millerjp
millerjp / sstable_load.sh
Created March 14, 2016 19:23
wrapper for sstableloader to load one file at a time, rename and moved completed to directory
#!/bin/bash
#This is the directory that teh sstables will be palce into load - the table name is also going to be changed from v2 to v4
WORKING_DIR=/somecompany/cassandra/data/sstable_loading_dir/someks/sometable_v4
COMPLETED_DIR=/somecompany/cassandra/data/sstable_completed_dir
mkdir -p $COMPLETED_DIR
mkdir -p $WORKING_DIR
rm -rf $WORKING_DIR/*
@millerjp
millerjp / nativeReport.sh
Last active March 11, 2016 09:47
Workout and count which hosts are connecting on the cassandra native port
#!/bin/bash
# Scipt to count connected hosts on port, preform nslookup of hosts and output details
#
HOSTNAME=`hostname`
PORT=$1
IP_HOSTS_COUNT=`netstat -tn | 'next unless(/^tcp\s+\d+\s+\d+\s+\S+?:${PORT}\s+(\S+)?:/); print "$1\n";' | sort | uniq -c | awk '{print "tohost\t",$1,"\t"$2,"\tfromhost\n"}'`
while read -r line; do
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
@millerjp
millerjp / disk-setup.sh
Last active September 15, 2015 08:54 — forked from tobert/disk-setup.sh
#!/bin/bash
# DANGER: ALL DATA WILL BE DELETED
# assumes disk order is consistent
# atobey@datastax.com 2015-05-09
export PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
die () { echo "FATAL: $*"; exit 1; }