Skip to content

Instantly share code, notes, and snippets.

@leejones
Created June 14, 2016 14:39
Show Gist options
  • Save leejones/34e7ca5952baa4fedf3df74a52f24b61 to your computer and use it in GitHub Desktop.
Save leejones/34e7ca5952baa4fedf3df74a52f24b61 to your computer and use it in GitHub Desktop.
#!/bin/bash
host="$1"
workspace="/tmp/memcached-keys/$1"
rm -rf "$workspace"
mkdir -p "$workspace/items"
for item in $(echo "stats items" | nc "$host" 11211 | grep items | awk '{print $2}' | cut -d : -f 2 | sort -n | uniq); do
echo "stats cachedump $item 1000000" | nc "$host" 11211 > "$workspace/items/$item"
done
echo "INFO: Dumped keys to ${workspace}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment