What's the simplest way to get a dump of all memcached keys into a file?

前端 未结 5 1904
挽巷
挽巷 2020-12-30 04:15

This is from just a single memcached server with around 20M keys (no expiry) and around 2G of data.

What\'s the easiest way to get a dump of all the key/value pairs

5条回答
  •  一向
    一向 (楼主)
    2020-12-30 05:00

    Bash

    Using Bash and save into the file:

    exec {memcache}<>/dev/tcp/localhost/11211
    printf "stats items\nquit\n" >&${memcache}
    cat <&${memcache} > myfile.txt
    

    Related: Writing a Redis client in pure bash (it's Redis, but very similar approach)

提交回复
热议问题