---
title: "如何从production 的 redis 复制 key 到本地"
author: "hellosoft"
date: "2017-02-07T10:03:32Z"
tags: []
categories: ["互联网"]
slug: "production-redis-key"
draft: false
lastmod: "2017-02-07T10:03:32Z"
id: 2355836
url: "https://hellosoft.iteye.com/blog/2355836"
---

如何从production 的 redis 复制 key 到本地

remoteRedis&gt; dump keyName  
可以得到一串序列化后的字符串，类似于： "\\x00\\x04test\\a\\x00~\\xa2zSd;e\_"

localRedis&gt; restore keyName 0 "\\x00\\x04test\\a\\x00~\\xa2zSd;e\_"

如此，即将remoteRedis的指定key复制到了本地。

参考文档：  
https://redis.io/commands/restore