Redis Migrator
This will take the keys from one server/db and transfer them to another server/db. It iterates over the keys in SOURCE and recreates them on DESTINATION.
This will not wipe out any existing data in DESTINATION, with the exception of Lists which have to be replaced entirely on the DESTINATION. Strings will obviously be replaced. Hashes will only be updated, any pre-existing hash fields set on the DESTINATION will remain if they are not replaced by the SOURCE.
Any pre-existing keys on DESTINATION that are not on SOURCE will remain untouched.
Example
time redis-migrator --source-host 127.0.0.1 --source-db 0 --destination-host 127.0.0.1 --destination-db 1
SOURCE:
Server: 127.0.0.1:6379
DB Index: 0
Auth: None
DESTINATION:
Server: 127.0.0.1:6379
DB Index: 1
Auth: None
2021-02-22 07:08:37 INFO => Source has 622028 keys
2021-02-22 07:08:37 INFO => Destination has 0 keys
2021-02-22 07:08:37 INFO => Found 622028 keys on SOURCE with Key filter: *
2021-02-22 07:08:37 INFO => Migration running, each dot is ~1,000 keys
.......... .......... .......... .......... .......... 8% (50012 / 622028)
.......... .......... .......... .......... .......... 16% (100028 / 622028)
.......... .......... .......... .......... .......... 24% (150037 / 622028)
.......... .......... .......... .......... .......... 32% (200046 / 622028)
.......... .......... .......... .......... .......... 40% (250058 / 622028)
.......... .......... .......... .......... .......... 48% (300073 / 622028)
.......... .......... .......... .......... .......... 56% (350084 / 622028)
.......... .......... .......... .......... .......... 64% (400090 / 622028)
.......... .......... .......... .......... .......... 72% (450102 / 622028)
.......... .......... .......... .......... .......... 80% (500113 / 622028)
.......... .......... .......... .......... .......... 88% (550127 / 622028)
.......... .......... .......... .......... .......... 96% (600147 / 622028)
.......... .......... ..
2021-02-22 07:16:33 INFO => Migration completed with 622004 keys, 0 skipped :)
real 7m55.358s
user 0m52.892s
sys 4m32.788s
See the Github project for even more documentation.
Redis Renamer
This will simply rename the matching keys with a given prefix. This is useful if you’re running a shared redis instance, and your existing keys need to be prefixed as a result.
See the Github project for even more documentation.