A quick way to get memcached status

A quick way to get memcached status

PREVIOUS POST
NEXT POST

There are all sorts of different interfaces to memcached, but you don’t need any of them to make requests from the command line, because its protocol is so simple. Try this, assuming it’s running on the usual port on the local machine:

Here’s an easy “top” emulator for memcached:

If you don’t have netcat (nc), you can also use Bash’s built-in /proc/tcp magic if it’s enabled. Anything that can push a couple of characters to a TCP port and print the result to stdout will work. Or you can use something like this, if you must do it via PHP:

More resources…

Blog Posts

PREVIOUS POST
NEXT POST

Share this post

Comments (5)

  • Dieter_be Reply

    You can do even more fun/specific stuff like ‘stats items’, ‘stats sizes’, ‘stats slabs’, …
    See http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt

    Another client worth mentioning is telnet. The advantage over netcat is the interactivity. (but then again nc is good for scripting)

    November 27, 2008 at 6:15 am
  • gorenje Reply

    watch “(echo stats ; echo quit ) | nc 127.0.0.1 11211” works, echo stats doesn’t since memcache expects you to quit the connection.

    August 31, 2010 at 5:09 am
  • Steve Batcup Reply

    This helped me a great deal, thank you.

    January 29, 2013 at 5:41 am
  • Emptywalls Reply

    Thanks! Exactly what I needed.

    August 15, 2013 at 4:17 pm
  • Mischa ter Smitten Reply

    @gorenje You can also use the -q option:

    watch “echo stats | /bin/netcat -q 2 127.0.0.1 11211”;

    October 29, 2014 at 4:11 am

Leave a Reply