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

前端 未结 5 1906
挽巷
挽巷 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 04:51

    I used this bash script

    #!/bin/sh
    MESSAGE=`memdump --servers="127.0.0.1"`
    while read -r line; do
        echo $line
        VALUE=`echo "get $line" | nc 127.0.0.1 11211`
        echo $VALUE
    done <<< "$MESSAGE"
    

    just replace IP / port if necessary

提交回复
热议问题