https://github.com/ryan-shaw/go-redis-migrate
https://github.com/ryan-shaw/go-redis-migrate
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ryan-shaw/go-redis-migrate
- Owner: ryan-shaw
- License: mit
- Created: 2023-07-27T17:58:16.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-28T15:55:38.000Z (almost 3 years ago)
- Last Synced: 2024-06-21T08:21:19.722Z (almost 2 years ago)
- Language: Go
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🚀 Redis command replicator 🚀
This program is a Redis command processor that reads commands from a source Redis instance, processes them, and then writes them to a target Redis instance. It's a multi-threaded application that uses a worker-pool pattern for processing commands concurrently. This program also keeps track of the number of executed commands for performance monitoring.
## 📝 Features 📝
- Reads commands from a source Redis instance
- Waits for target to becomem writeable (role:master)
- Processes commands and writes them to a target Redis instance
- Multi-threaded operation using a worker-pool pattern for processing commands concurrently
- Performance monitoring with a command counter
## 🛠️ How to use 🛠️
You can customize the source and target Redis hosts via command-line flags. There is also a debug mode flag to increase logging verbosity.
Example usage:
```sh
redis-migrate -sourceHost "localhost:6379" -targetHost "localhost:6380" -debug
```
## 📈 Performance Monitoring 📈
The program keeps track of the number of executed commands in a thread-safe manner. It uses atomic operations to update a global counter. The counters are logged every second to monitor the system's performance.
## 🚨 Warning 🚨
As specified in the Redis docs running `MONITOR` can have serious impact on performance, up to 50% performance hit depending on the workload. The [benchmark](https://redis.io/commands/monitor/) exmaple is quite extreme as that is maxing the capabilities of Redis and hopefully your normal workload is not near 100% resource usage. I would seriously recommend ensuring their is enough resource capacity on your source Redis instance before running this program.
It would be better to have this as a proxy to then proxy to both Redis instance but I want to have this without any modification to the stack.