I currently have a live redis server running on a cloud instance and I want to migrate this redis server to a new cloud instance and use that instance as my new redis server
Nowadays you can also use MIGRATE, available since 2.6.
I had to use this since I only wanted to move the data in one database and not all of them. The two Redis instances live on two different machines.
If you can't connect directly to Redis-2 from Redis-1, use ssh port binding:
ssh user@redis-2.foo.com -L 1234:127.0.0.1:6379
A small script to loop all the keys using KEYS and MIGRATE each key. This is Perl, but hopefully you get the idea:
foreach ( $redis_from->keys('*') ) {
$redis_from->migrate(
$destination{host}, # localhost in my example
$destination{port}, # 1234
$_, # The key
$destination{db},
$destination{timeout}
);
}
See http://redis.io/commands/migrate for more info.