How to recover redis data from snapshot(rdb file) copied from another machine?

前端 未结 7 1695

I transferred my redis snapshot (dump.rdb file) using scp to a remote server. I need to run a redis server on this remote and recover the data from the

7条回答
  •  难免孤独
    2021-01-30 04:20

    Or you can:

    1. Stop your redis server / instance, eg., service redis6379 stop
    2. Copy the dump.rdb file to the right location, eg., cp /path/to/dump-6379.rdb /var/lib/redis/dump-6379.rdb. Give it the right permissions (user:group should be redis:redis and mode 644)
    3. Start your redis server / instance, eg., service redis6379 start

    It is important that you stop the redis server before copying the file to the right location, because Redis saves a snapshot before terminating, so it will replace your file.

    Besides, you might want to back up the existing dump.rdb file first.

提交回复
热议问题