1. 程式人生 > >Memcached 數據導出與導入

Memcached 數據導出與導入

超過 tmp cal 返回 mil memcache red 導入 host

我們使用 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

Memcached 數據導出與導入