Redis 中文文档 Redis 中文文档
指南
redis.io (opens new window)
指南
redis.io (opens new window)
  • 关于
    • Redis 开源治理
    • Redis 发布周期
    • Redis 赞助商
  • 入门
  • 数据类型
  • Redis Stack
  • 命令
  • 手册
Rump

Hot sync two Redis databases using dumps.

Why


There's no easy way to sync data from an AWS ElastiCache or GCP MemoryStore Redis cluster; the standard commands BGSAVE and SLAVEOF are blocked.

Rump is able to live sync Redis databases across cloud providers by only using SCAN, DUMP and RESTORE.

It's used at Sticker Mule to keep staging and development environments in sync with the production AWS/GCP Redis clusters.

Examples


  1. ``` shell
  2. # Sync local Redis DB 1 to DB 2.
  3. $ rump -from redis://127.0.0.1:6379/1 -to redis://127.0.0.1:6379/2

  4. # Sync ElastiCache cluster to local.
  5. $ rump -from redis://production.cache.amazonaws.com:6379/1 -to redis://127.0.0.1:6379/1

  6. # Sync protected ElastiCache via EC2 port forwarding.
  7. $ ssh -L 6969:production.cache.amazonaws.com:6379 -N username@xxx.xxx.xxx.xxx &
  8. $ rump -from redis://127.0.0.1:6969/1 -to redis://127.0.0.1:6379/1

  9. # Dump GCP MemoryStore to file.
  10. $ rump -from redis://10.0.20.2:6379/1 -to /backup/memorystore.rump

  11. # Restore backup to ElastiCache.
  12. $ rump -from /backup/memorystore.rump -to redis://production.cache.amazonaws.com:6379/1

  13. # Sync with verbose mode disabled.
  14. $ rump -from redis://127.0.0.1:6379/1 -to redis://127.0.0.1:6379/2 -silent

  15. # Sync with TTLs.
  16. $ rump -from redis://127.0.0.1:6379/1 -to redis://127.0.0.1:6379/2 -ttl
  17. ```

Features


Uses SCAN instead of KEYS to avoid DoS servers.
Doesn't use any temp file.
Can sync any key type.
Can optionally sync TTLs.
Uses buffered channels to optimize slow source servers.
Uses implicit pipelining to minimize network roundtrips.
Supports two-step sync: dump source to file, restore file to database.
Supports Redis URIs with auth.
Offers the same guarantees of the SCAN command.

Demo


Development


  1. ``` shell
  2. # requirements: docker, docker-compose (dc)
  3. dc up # watch/run Rump tests and a Redis container
  4. dc run --rm rump sh # get shell on Rump container
  5. dc run --rm redis sh; redis-cli -h redis # get Redis console
  6. ```

Install


Binaries can be found on the releases page.

  1. ``` sh
  2. curl -SL https://github.com/stickermule/rump/releases/download/1.0.0/rump-1.0.0-linux-amd64 -o rump \
  3.   && chmod +x rump;
  4. ./rump

  5. ```

You can run rump in a container following the Dockerfile.example.

Mentions


Sticker Mule Blog
The Changelog
Go Weekly
DB Weekly
Cron Weekly
Hacker News
Redis Weekly

Maintainers


nixtrace

Collaboration & License


Contributing
Code of Conduct
MIT License
Last Updated: 2023-09-03 19:17:54