Redis recovery is done on docker from dump.rdb

What I want to do is use dump.rdb, which I took from the production server, and use it in my development environment, which is defined by a very simple build file.

For simplicity, suppose my application is the same as compiling an example from docker docs for redis and flask, so docker-compose.yml looks like this:

version: '2'
 services:
   web:
     build: .
     ports:
      - "5000:5000"
     volumes:
      - .:/code
     depends_on:
      - redis
   redis:
     image: redis

This doesn’t allow you to redraw data between restarts, but you simply cannot access the redis files, since the docker-compose.yml file does not have a volume installed for redis. Therefore, I am editing my layout file to mount the volume for redis, and I also want to force redis to save the data, and official documents redis image

redis:
  image: redis
  command: redis-server --appendonly yes
  volumes:
    - ./redis:/data

, , , dump.rdb appendonly.aof /redis. , dump.rdb, appendonly (, . " ", "How-to-back-up-and-restore-your-redis-data-on-ubuntu-14" ) -04), append-only , .

, , dump.rdb, , , ?

, , dump.rdb (, , ). redis , appendonly, :

redis:
  image: redis
  volumes:
    - ./redis:/data
+4
1

, , dump.rdb , : , , "redis-server".

, / dump.rdb .

+1

Source: https://habr.com/ru/post/1657070/


All Articles