@@ -17,9 +17,9 @@ Any pre-existing keys on DESTINATION that are not on SOURCE will remain untouche
1717## Usage
1818
1919``` bash
20- Usage: redis-migrator --source-host SOURCE-HOST --destination-host DESTINATION-HOST
21- [--source-port SOURCE-PORT ] [--source-db SOURCE-DB ] [--source-user SOURCE-USER ]
22- [--source-pass SOURCE-PASS] [--destination-port DESTINATION-PORT]
20+ Usage: redis-migrator --source-host SOURCE-HOST [--source-port SOURCE-PORT]
21+ [--source-db SOURCE-DB ] [--source-user SOURCE-USER ] [--source-pass SOURCE-PASS ]
22+ --destination-host DESTINATION-HOST [--destination-port DESTINATION-PORT]
2323 [--destination-db DESTINATION-DB] [--destination-user DESTINATION-USER]
2424 [--destination-pass DESTINATION-PASS] [--source-filter SOURCE-FILTER]
2525 [--destination-prefix DESTINATION-PREFIX] [--verbose]
@@ -51,6 +51,7 @@ Options:
5151 destination key prefix to prepend
5252 --verbose, -v Print a lot more info
5353 --help, -h display this help and exit
54+ --version display version and exit
5455```
5556
5657## Install
@@ -73,3 +74,44 @@ git clone https://github.com/jc21/redis-migrator && cd redis-migrator
7374go build -ldflags=" -X main.version=1.0.1" -o bin/redis-migrator cmd/redis-migrator/main.go
7475./bin/redis-migrator -h
7576```
77+
78+
79+ ## Real world example
80+
81+ Copying data from one db to another on the same instance. This is a production instance
82+ where the keys were expiring mid-way through the migration, hence why the total
83+ number of keys migrated doesn't match the initial count.
84+
85+ ``` bash
86+ time redis-migrator --source-host 127.0.0.1 --source-db 0 --destination-host 127.0.0.1 --destination-db 1
87+ SOURCE:
88+ Server: 127.0.0.1:6379
89+ DB Index: 0
90+ Auth: None
91+ DESTINATION:
92+ Server: 127.0.0.1:6379
93+ DB Index: 1
94+ Auth: None
95+ 2021-02-22 07:08:37 INFO => Source has 622028 keys
96+ 2021-02-22 07:08:37 INFO => Destination has 0 keys
97+ 2021-02-22 07:08:37 INFO => Found 622028 keys on SOURCE with Key filter: *
98+ 2021-02-22 07:08:37 INFO => Migration running, each dot is ~ 1,000 keys
99+ .......... .......... .......... .......... .......... 8% (50012 / 622028)
100+ .......... .......... .......... .......... .......... 16% (100028 / 622028)
101+ .......... .......... .......... .......... .......... 24% (150037 / 622028)
102+ .......... .......... .......... .......... .......... 32% (200046 / 622028)
103+ .......... .......... .......... .......... .......... 40% (250058 / 622028)
104+ .......... .......... .......... .......... .......... 48% (300073 / 622028)
105+ .......... .......... .......... .......... .......... 56% (350084 / 622028)
106+ .......... .......... .......... .......... .......... 64% (400090 / 622028)
107+ .......... .......... .......... .......... .......... 72% (450102 / 622028)
108+ .......... .......... .......... .......... .......... 80% (500113 / 622028)
109+ .......... .......... .......... .......... .......... 88% (550127 / 622028)
110+ .......... .......... .......... .......... .......... 96% (600147 / 622028)
111+ .......... .......... ..
112+ 2021-02-22 07:16:33 INFO => Migration completed with 622004 keys, 0 skipped :)
113+
114+ real 7m55.358s
115+ user 0m52.892s
116+ sys 4m32.788s
117+ ```
0 commit comments