Docker redis container passed dump.rdb File for data migration or data recovery

Time:2021-2-23

Docker redis container passed dump.rdb File for data migration or data recovery

Pull redis image

#Pull the latest redis image
$docker pull redis

Enter the old redis container to save the data

$docker exec -it old_aley_redis redis-cli
127.0.0.1:6379>save

Copy dump.rdb file

The Save command will generate dump.rdb If you don’t know where to save the generated file, you can use theDocker inspect container nameCheck the source value of container information under mounts to see the save location

$ docker run -it --name aley_redis -v /home/aley/data/dump.rdb:/data/dump.rdb -p 6379:6379 redis:latest /bin/bash
$ redis-server

The redis image pulled directly has no configuration file. You need to download the configuration file yourself. The download address of the configuration file is:http://download.redis.io/redis-stable/redis.conf. Mount the modified configuration file to the container. Then specify the configuration file when starting redis service.

$ $ docker run -it --name aley_redis -v /home/aley/data/redis.conf:/data/redis.conf -p 6379:6379 redis:latest /bin/bash
$ redis-server /data/redis.conf

Recommended Today

Third party calls wechat payment interface

Step one: preparation 1. Wechat payment interface can only be called if the developer qualification has been authenticated on wechat open platform, so the first thing is to authenticate. It’s very simple, but wechat will charge 300 yuan for audit 2. Set payment directory Login wechat payment merchant platform( pay.weixin.qq . com) — > Product […]