Skip to content

Instantly share code, notes, and snippets.

@itayadler
Last active November 10, 2015 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itayadler/8cb766c419dabac44982 to your computer and use it in GitHub Desktop.
Save itayadler/8cb766c419dabac44982 to your computer and use it in GitHub Desktop.
Prints out big partitions found during cassandra's compaction procedure
#!/bin/bash
set -e
#NOTE: Tested on cassandra 2.1 only, please leave a comment if this breaks on other versions.
#This script prints to stdout the big partitions cassandra is warning about during compaction.
#It goes over all the cassandra logs (all of the ones found on the server), and prints in ascending
#order the big partitions that were found during compaction.
#Usage example:
#ssh user@server.hostname 'bash -s' < big-partitions.sh
zgrep -e 'Compacting large partition' /var/log/cassandra/system* | awk '{print $10 $11}' | awk -F ":" '{print $1,$2}' | awk -F "(" '{print $1,$2}' | awk -F " " '{print $1,$2,$3/1048576 "MB"}' | sort -k 3 -n -r | awk -F " " '!seen[$2]++' | sort -k 3 -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment