Are there any tools to explore what is currently cached inside a memcached pool? Not some much graphs, but the actual key/values currently stored.
Are there any tools to explore what is currently cached inside a memcached pool? Not some much graphs, but the actual key/values currently stored.
The correct answer would be
echo "stats cachedump SLABS_ID LIMIT" | nc HOSTNAME PORT
eg.
echo "stats cachedump 15 4" | nc 127.0.0.1 11211
This would give the output on the lines of:
Note: This is an undocumented command that is not supported by the memcached team and can be removed in any version. For the complete reference, check out Understanding Memcached stats cachedump command.
memcached-tool
In the recent version of
memcached
there is alsomemcached-tool
perl script, e.g. usage:which dumps all keys and values.
memdump
To dump a list of keys from a server, use
memcdump
/memdump
tool, e.g.To dump all objects:
To dump all key values into separate files:
memccat
To print a key value, you can use
memccat
command, e.g.Bash
To dump all keys in Bash shell, try:
netcat
Here is example to get value of single item using
netcat
:Python
See: How to export all keys and values from memcached with Python?
Try
stats items
- i.e.Try using
telnet
command, e.g.:Install
libmemcached-tools
and then you can use this command to get all the keys:To see the contents, you can ask for a specific key:
or you can loop over the list of keys in Bash:
Make sure to use 127.0.0.1 (if you are running the command on the same host) because
localhost
does not seem to work.In basic memcached I do not think there is any way of querying for keys stored in the server. The only think you can get is statistics related to storage and stored items.
Some vendors that have developed memcached compliant solutions, e.g. Gear6, have however added functionality to allow querying.