search by tags

for the user

adventures into the land of the command line

migrate a redis db using the append only file

copy your valuable appendonly.aof file to the shiny new computer you want to import it to

$ scp appendonly.aof 12.34.56.78:/var/tmp/
appendonly.aof                 100%   74KB  74.4KB/s   00:00

ssh into the computer and have a squiz at the blank install. 0 bytes, empty .aof file. *nod

$ ssh 12.34.56.78
$ ls -l /mnt/data/redis/redis_instance1/
total 4
-rw-r--r-- 1 root root  0 Mar  8 07:33 appendonly.aof
-rw-r--r-- 1 root root 18 Mar  8 18:34 dump.rdb

login to the redis instance, yep, nothing, *nod

$ redis-cli
127.0.0.1:6379> keys '*'
(empty list or set)
127.0.0.1:6379>

move your .aof file with the data in it to your redis data directory, overriding the blank one. *nod

$ sudo mv /var/tmp/appendonly.aof /mnt/data/redis/redis_instance1/
$ ls -l /mnt/data/redis/redis_instance1/
total 80
-rw-r--r-- 1 root root 76217 Mar  8 18:37 appendonly.aof
-rw-r--r-- 1 root root    18 Mar  8 18:34 dump.rdb

restart redis. *nod

$ sudo /etc/init.d/redis-server_instance1 restart
Stopping redis_instance1:                        [  OK  ]
Starting redis_instance1:                        [  OK  ]

login to the redis instance, yep, things, *nod

$ redis-cli
127.0.0.1:6379> keys '*'
1) "f7f5e517-c758-4429-a3e5-0cd6bab5a75f"
2) "1c1b9d45-8398-4137-ada4-10c567f04bf3"
3) "03a444a0-0a9c-4a96-a65b-64b22fa62cf8"
4) "a734df4d-43e3-4590-85eb-8748698df8a4"
5) "6f3cda46-fbd5-4cd0-9a56-65667d4c7444"
6) "c69642c6-7c92-45f1-b462-b759c88814c3"
127.0.0.1:6379>