Copying all keys in Redis database using MIGRATE

前端 未结 5 2306
Happy的楠姐
Happy的楠姐 2021-02-20 08:13

Is it possible to copy all keys from one Redis instance to another remote instance using MIGRATE? I\'ve tried COPY, REPLACE and KEYS

5条回答
  •  天命终不由人
    2021-02-20 08:46

    If you are running on non-managed¹ redis instances, the most ideal way would probably to run the target instance as a replica temporarly and then disable (after all data is copied) the replication.

    see the REPLICAOF command in redis. how to apply it (all commands on the target instance):

    initiate the replication: $ replicaof source_hostname_or_ip source_port

    after everything is done: $ replicaof no one

    If you can't use this command¹ then you can try this script on the digital ocean blog: https://www.digitalocean.com/community/tutorials/how-to-migrate-redis-data-to-a-digitalocean-managed-database#step-3-%E2%80%94-building-the-migration-script

    ################

    ¹ - managed services often restrict the usage of this command see here or here.

提交回复
热议问题