# RedisCopy
This utility provides a way to move the contents of one redis DB to another
redis DB. It is inspired by the [redis-copy.rb script][original] included in
the redis source, but aims to always support all object types and to use the
most-efficient methods and commands available to your redis versions:
- if available on both dbs, will use `DUMP`/`RESTORE` commands (redis v2.6+)
- if available on source db, will use `SCAN` instead of `KEYS` (redis v2.8+)
[original]: https://github.com/antirez/redis/commits/unstable/utils/redis-copy.rb
## Installation
$ gem install redis-copy
## Usage
The current options can be grabbed using the `--help` flag.
```
$ redis-copy --help
redis-copy v1.0.0 (with redis-rb 3.0.6)
Usage: redis-copy [options] <source> <destination>
<source> and <destination> must be redis connection uris
like [redis://][<username>:<password>@]<hostname>[:<port>][/<db>]
Specific options:
-p, --pattern PATTERN Only transfer matching keys (default *)
See http://redis.io/commands/keys for more info.
-v, --[no-]verify [PERCENT] Verify percentage of transfers -- VERY SLOW (default 0)
-n, --[no-]allow-nonempty Allow non-empty destination (default false)
-f, --[no-]fail-fast Abort on first failure (default false)
--[no-]pipeline Pipeline redis commands where available (default true)
-r, --require FILENAME Require a script; useful for loading third-party
implementations of key-emitter or copy strategies.
Relative paths *must* begin with `../' or `./'.
-d, --[no-]debug Write debug output (default false)
-t, --[no-]trace Enable backtrace on failure (default false)
--[no-]prompt Prompt for confirmation (default true)
--[no-]dry-run Output configuration and exit
```
## Example:
```
$ redis-copy --no-prompt old.redis.host/9 new.redis.host:6380/3
Source: redis://old.redis.host:6379/9
Destination: redis://new.redis.host:6380/3 (empty)
Key Emitter: Scan
Strategy: DumpRestore
PROGRESS {:success=>1000, :attempt=>1000}
PROGRESS {:success=>2000, :attempt=>2000}
PROGRESS {:success=>3000, :attempt=>3000}
PROGRESS {:success=>4000, :attempt=>4000}
DONE: {:success=>4246, :attempt=>4246}
```
## Extensibility:
`RedisCopy` uses the [implements][] gem to define interfaces for key-emitter
and copy strategies, so implementations can be supplied by third-parties,
secondary gems, or even a local script; the interface shared examples are even
available on your load-path so you can ensure your implementation adheres to
the interface.
See the existing implementations and their specs for examples, and use the
`--require` command-line flag to load up your own. Since `implements` treats
last-loaded implementations as inherently better, `RedisCopy` will automatically
pick up your implementation and attempt to use it before the bundled
implementations.
[implements]: https://rubygems.org/gems/implements
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
没有合适的资源?快使用搜索试试~ 我知道了~
将一个 redis db 复制到另一个 redis db.zip
共33个文件
rb:21个
txt:3个
yml:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 133 浏览量
2024-12-04
12:08:56
上传
评论
收藏 21KB ZIP 举报
温馨提示
将一个 redis db 复制到另一个 redis dbRedis复制此实用程序提供了一种将一个 redis DB 的内容移动到另一个 redis DB 的方法。它受到redis 源中包含的redis-copy.rb 脚本的启发,但旨在始终支持所有对象类型并使用适用于您的 redis 版本的最高效方法和命令如果两个数据库上都可用,将使用DUMP/RESTORE命令(redis v2.6+)如果源数据库上可用,将SCAN代替使用KEYS(redis v2.8+)安装$ gem install redis-copy用法可以使用标志来获取当前选项--help。$ redis-copy --helpredis-copy v1.0.0 (with redis-rb 3.0.6)Usage: redis-copy [options] <source> <destination> <source> and <destination> must be redis connection uris like [redis://][<username>:<pa
资源推荐
资源详情
资源评论
收起资源包目录
将一个 redis db 复制到另一个 redis db.zip (33个子文件)
lib
redis-copy.rb 3KB
redis-copy
strategy.rb 2KB
key-emitter.rb 1013B
core_ext.rb 54B
ui.rb 633B
version.rb 60B
key-emitter
interface.spec.rb 2KB
keys.rb 2KB
scan.rb 558B
ui
command_line.rb 586B
auto_run.rb 327B
strategy
interface.spec.rb 11KB
dump-restore.rb 919B
classic.rb 4KB
cli.rb 5KB
Rakefile 1KB
.travis.yml 210B
标签.txt 2B
redis-copy.gemspec 2KB
LICENSE.txt 1KB
redis-copy_spec.rb 0B
spec
redis-copy
key-emitter
scan_spec.rb 219B
keys_spec.rb 1KB
strategy
classic_spec.rb 720B
dump-restore_spec.rb 216B
redis.spec.conf 137B
spec_helper.rb 955B
db
.gitkeep 0B
bin
redis-copy 154B
资源内容.txt 792B
Gemfile 57B
.gitignore 162B
README.md 3KB
共 33 条
- 1
资源评论
徐浪老师
- 粉丝: 8316
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 毕业设计视频监控系统,qt + v4l2 + opencv + sqlite.zip
- 基于JavaScript的logsets:跨语言支持的Node.js命令行终端程序库设计源码
- 基于Python的进销存管理系统设计源码
- 基于Java、JavaScript、CSS的教育培训项目功能设计源码
- 基于Vue框架的酒店客房管理系统设计源码
- 基于Python与多语言混合开发的stable-diffusion-webui设计源码
- 基于Java的迪思杰(北京)数据管理技术有限公司数据调度器设计源码
- 毕业设计考勤系统(Vue+Webpack+ElementUI).zip
- 毕业设计美食分享平台.zip
- 毕业设计管理系统(SSM,Layui框架毕业设计).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功