Redis data is copied to another Redis
Recently, I used a problem. I need to copy the data of Redis to another Redis. Now I will summarize the solution to the problem.
Solution one:
redis-dump export
[root@ ~]# redis-dump -u :[email protected]:6379 > 172.20.0.1.json
redis-load import
[root@ ~]# cat 172.20.0.1.json | redis-load -u :[email protected]:6379
Solution two:
1. Copy the dump.rdb file under the /usr/local/java/redis-3.2.3/datas directory under the redis installation directory.
2. Paste it into the /usr/local/java/redis-3.2.3/datas directory under the redis installation directory to be copied.
3. Restart the redis service in the bin directory: ./redis-server /usr/local/java/redis-3.2.3/etc/redis.conf
find / -name dump.rdb
If redis is one master and two slaves, first close the slave redis, then close the master redis, then transfer the rdb file, then restart the master redis, and finally restart the slave redis to synchronize the data