Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest way to copy 35GB of redis from one instance to another (in Azure standard)

We have two Azure Redis instances on Azure. The source is on "standard" setting in Azure. We need to copy all 35GB from a standard build to a premium build (not migrate).

What is the best method? The data should be static. You cannot export the data in standard, you cannot shard either. We have maxed out the size, and need to move to one that supports sharding.

like image 794
user1005246 Avatar asked Oct 31 '25 07:10

user1005246


1 Answers

1. Editing config file

In target Redis's config file set

slaveof sourceIP sourcePort
slave-read-only no

It will efficiently replicate source db into your new one by transmitting RDB file. Then you can comment out these lines and shut down source instance. Note, that old keys in target instance are not preserved and not rewritten.

2. CONFIG SET command

Will not help you on this, sad story.

127.0.0.1:6371> CONFIG SET slaveof "localhost 6370"
(error) ERR Unsupported CONFIG parameter: slaveof

3. MIGRATE command

MIGRATE remotehost remoteport "" 0 5000 COPY KEYS *

Will not work either. But there is a workaround: https://stackoverflow.com/a/42686861/78569

redis-cli --raw KEYS '*' | xargs redis-cli MIGRATE my.redis 6379 "" 0 5000 KEYS

(please upvote that guy, if you used it)

4. Shell scripting

Here's a script that pipes KEYS output into MIGRATE and adds some other features: https://gist.github.com/nicStuff/ee7feb8eed00174a46db42812545b403

5. RDB download

You can download RDB dump with Redis protocol even if you don't have access to the file on server:

redis-cli -h <host> -p <port> --rdb /path/to/local/copy/dump.rdb
like image 155
Imaskar Avatar answered Nov 02 '25 23:11

Imaskar