go-redismigrate

command module
v0.0.0-...-9dd187f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2025 License: MIT Imports: 9 Imported by: 0

README ΒΆ

Made with VHS

go-redismigrate

Fast, reliable Redis key migration with real-time progress monitoring

Migrate Redis keys between instances with streaming key scanning, conflict resolution, and a beautiful terminal interface.

Features β€’ Installation β€’ Quick Start β€’


✨ Features

  • πŸš€ High Performance: Pipeline-based operations with streaming key scanning
  • 🎯 Pattern Matching: Support for Redis glob patterns (user:*, session:*, etc.)
  • πŸ”„ Migration Modes: Copy or move keys between Redis instances
  • ⚑ Conflict Resolution: Error, skip, or overwrite existing keys
  • πŸ“Š Real-time Progress: Beautiful terminal UI with live metrics

πŸ“¦ Installation

Using Go Install
go install github.com/pucke-dev/go-redismigrate@latest
From Source
git clone https://github.com/pucke-dev/go-redismigrate.git
cd go-redismigrate
go build -o redismigrate

πŸš€ Quick Start

Basic Migration
# Copy all keys from db0 to db1
redismigrate --source redis://localhost:6379/0 --dest redis://localhost:6379/1

# Move user sessions to different Redis instance
redismigrate \
  --source redis://localhost:6379/0 \
  --dest redis://remote:6379/1 \
  --pattern "session:*" \
  --mode move
With Authentication
# Migrate with Redis AUTH
redismigrate \
  --source redis://user:pass@source.redis.com:6379/0 \
  --dest redis://user:pass@dest.redis.com:6379/0 \
  --pattern "app:*"

πŸ“‹ Usage

Usage: redismigrate [options]

Options:
  --source       Source Redis connection string  REQUIRED 
  --dest         Destination Redis connection string  REQUIRED 
  --pattern      Key pattern to match (Redis glob pattern) (default: *)
  --mode         Migration mode (default: copy)
  --conflict     Key conflict behavior (default: error)
  --batch-size   Number of keys to process in each batch (default: 100)
  --concurrency  Number of concurrent workers (default: 4)
  --verbose      Enable verbose logging (default: false)
  --version      Show version information
  --help         Show this help message

Examples:
  Basic copy migration:
   redismigrate -source redis://localhost:6379/0 -dest redis://localhost:6379/1 

  Move specific pattern:
   redismigrate -source redis://src:6379/0 -dest redis://dst:6379/0 -pattern "user:*" -mode move 

  High throughput with custom batch size:
   redismigrate -source redis://src:6379/0 -dest redis://dst:6379/0 -batch-size 500 -concurrency 8 

Mode Options:
  copy      Copy keys to destination (keeps source)
  move      Move keys to destination (removes from source)

Conflict Options:
  error     Stop migration on key conflicts
  skip      Skip conflicting keys
  overwrite Overwrite existing keys

πŸ“Š Migration Modes

Mode Description Use Case
copy Copy keys to destination, keep source Data replication, backup
move Move keys to destination, delete from source Database migration, cleanup

βš”οΈ Conflict Resolution

Behavior Description Use Case
error Stop migration on first conflict Safe migrations, data integrity
skip Skip existing keys, continue migration Incremental updates
overwrite Replace existing keys with source data Data synchronization

Project Structure

β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ migrate/          # Core migration logic
β”‚   β”œβ”€β”€ redis/            # Redis client with pipelining
β”‚   β”œβ”€β”€ stats/            # Real-time metrics tracking
β”‚   └── tui/              # Terminal user interface
β”œβ”€β”€ scripts/              # Development utilities
└── main.go              # CLI entry point

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


⭐ Star this repo if you find it useful! ⭐

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
internal
tui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL