memcache dump and load

Paul Lindner lindner at inuus.com
Thu Apr 12 22:28:42 UTC 2007


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:

  http://code.sixapart.com/svn/memcached/trunk/server/scripts/memcached-tool

I was able to dump and reload some of our smaller production caches
and it seems okay.

-- 
Paul Lindner        ||||| | | | |  |  |  |   |   |
lindner at inuus.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/memcached/attachments/20070412/6fe4ccee/attachment-0001.pgp


More information about the memcached mailing list