Skip to content

This tool is designed to migrate Redis database keys from one server to another, addressing the pain point of missing 'REPLICAOF' on AWS ElastiCache

License

Notifications You must be signed in to change notification settings

huantt/redis-migrator

This branch is 10 commits ahead of opstree/redis-migration:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Oct 19, 2023
74a0afb · Oct 19, 2023

History

23 Commits
Oct 19, 2023
Oct 19, 2023
Oct 19, 2023
Oct 19, 2023
Oct 19, 2023
Oct 18, 2023
Oct 19, 2023
Oct 19, 2023
Oct 19, 2023
Dec 14, 2020
Oct 19, 2023
Dec 14, 2020
Dec 14, 2020
Oct 19, 2023
Oct 19, 2023
Oct 19, 2023

Repository files navigation

About

GitHub Super-Linter made-with-Go GitHub go.mod Go version Go Report Card Apache License GitHub release (latest by date)

The Redis Migrator is a Golang-based tool designed to migrate database keys from one Redis cluster to another.

Since Redis 5.0.0, you can use REPLICAOF command to replicate data from one redis to another.

This application is developed for the older version of Redis or AWS ElastiCache instances that do not support REPLICAOF command (AWS docs).

(This repo is forked from opstree/redis-migration. The original repo has been inactive for over 3 years, so I decided to continue its development without creating pull requests.)

Supported key types:

  • String
  • Hash
  • List
  • Set
  • Sorted Set

Usage

Installation

Using Go

go install github.com/huantt/redis-migrator@latest

Using Docker

docker run \
--rm \
-v /path/to/migrate.yaml:/data/migrate.yaml \
 huanttok/redis-migrator migrate \
 --config.file=/data/migrate.yaml \
--log.level=debug

To call localhost while using Docker, use host.docker.internal instead.

Configuration

For using redis-migrator, we have to create a configuration file and provide some needful information to it. An example configuration file will look like this

---
old_redis:
  host: localhost # IP redis server
  port: 6379 # Port redis server
  password: "" # Password of redis server, leave empty if there is no password

new_redis:
  host: localhost
  port: 6380
  password: ""

migration_databases: [0,1,2,3,4,5,6,7,8] # Databases list which needs to be migrated
concurrent_workers: 5
clear_before_migration: true

Available Options

There are help page available for redis-migrator which can be called by help or --help command.

$ redis-migrator help
A tool for migrating redis database and its keys.

Usage:
  redis-migrator [flags]
  redis-migrator [command]

Available Commands:
  help        Help about any command
  migrate     Runs redis-migrator to run migration
  version     Prints the current version.

Flags:
  -h, --help                help for redis-migrator
      --log.format string   redis-migrator log format. (default "text")
      --log.level string    redis-migrator logging level. (default "info")

Use "redis-migrator [command] --help" for more information about a command.

Using redis-migrator

Simply we have to specify the path of config.yaml

$ redis-migrator migrate --config.file config.yaml --log.level=debug

About

This tool is designed to migrate Redis database keys from one server to another, addressing the pain point of missing 'REPLICAOF' on AWS ElastiCache

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.8%
  • Dockerfile 2.2%