Memcached 数据导出与导入

我们使用 memcached-tool 命令来导出数据:

[root@localhost ~]# memcached-tool 127.0.0.1:11211 dump > /tmp/1.txt
Dumping memcache contents
  Number of buckets: 1
  Number of items  : 2
Dumping bucket 1 - 2 total items
[root@localhost ~]# cat /tmp/1.txt   //导出的数据是带有时间戳的,这个时间戳就是该条数据的过期时间
add name 0 1551489491 3              //如果当前系统时间超过了时间戳,那么是导入不进去的
Tom
add age 0 1551489491 2
18

使用 nc 命令来导入数据:

[root@localhost ~]# yum install -y nc
[root@localhost ~]# nc 127.0.0.1 11211 < /tmp/1.txt    //如果要导入的机器中有了这些数据,则返回NOT_STORED
STORED
STORED

    

原文地址:https://www.cnblogs.com/pzk7788/p/10460360.html