memcache dump and load

Brad Fitzpatrick brad at
Thu Apr 12 22:40:43 UTC 2007

This won't work.

cachedump is just for visual inspection... it has a very small buffer.  It
won't include everything.

I have some local patches to add a command to shut down the server
while dumping the cache (in a child process) to a binary file on disk,
which then can be parsed (in Perl), and async "add"'d later to the newly
running memcached.  I should post those.

On Thu, 12 Apr 2007, Paul Lindner wrote:

> So, I was poking through the code and came across two little gems,
> "stats items" and "stats cachedump".  That got me thinking about how
> to solve a common problem, which is cold caches when upgrading.
> So I wrote up and committed some modifications to memcached-tool that
> should help.
> Basically here's what you do:
>   memcached-tool host:port dump > /tmp/keys
>   # upgrade cache
>   nc host:port < /tmp/keys
> The script writes out memcache protocal with add statements, so if you
> app writes a key the old value won't overwrite it.
> I just threw this together in the past hour, so it has some rough
> edges and can be improved in a lot of ways.  Anyone want to give it a
> try?  You can find it here:
> I was able to dump and reload some of our smaller production caches
> and it seems okay.
> --
> Paul Lindner        ||||| | | | |  |  |  |   |   |
> lindner at

More information about the memcached mailing list