# 17.8 redis-dump方式导入导出数据

## 安装redis-dump工具

安装ruby（略）,详见上一章节

```
gem install redis-dump -V
```

## 数据导出

示例

```
redis-dump -u 127.0.0.1:6379 -a 'zykjdr#558996' > test.json
```

## 数据导入

示例

```
< test.json redis-load -u 127.0.0.1:6379 -a 'zykjdr#558996'
```

导入本机的6379端口，没有密码时，可以写成下面这样

```
< test1.json redis-load
```

**如果报错，请使用-n选项，使用请参考官方，请谨慎使用**！

-n （以二进制形式导入）

```
< test.json redis-load -n
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.clay-wangzhi.com/17-redis/17.8-redisdump-fang-shi-dao-ru-dao-chu-shu-ju.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
