Skip to content

Instantly share code, notes, and snippets.

@ivodvb
Last active September 5, 2017 15:34
Show Gist options
  • Save ivodvb/efba63e3de99cddd9d1438a02fb1f1c2 to your computer and use it in GitHub Desktop.
Save ivodvb/efba63e3de99cddd9d1438a02fb1f1c2 to your computer and use it in GitHub Desktop.
Memcached key dump, use export MEMCACHED_HOST=localhost to set the host (see https://stackoverflow.com/questions/19560150/get-all-keys-set-in-memcached#comment73667943_35892919)
#!/bin/bash
echo -e "stats items\nquit" | nc $MEMCACHED_HOST 11211 | grep -oe ':[0-9]*:' | grep -oe '[0-9]*' | sort | uniq | xargs -L1 -I{} bash -c 'echo -e "stats cachedump {} 1000\nquit" | nc $MEMCACHED_HOST 11211'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment