Answer the question
In order to leave comments, you need to log in
Redis in Docker cleans up all the data for some reason. What to do?
Hello.
Faced the following problem.
I am making an application that writes data and then reads it from redis . Redis
itself is running in a docker container.
When requested, I track the entry inside the container
127.0.0.1:6379> keys *
1) "-C7pZ9Dsy3:IvlhTR68"
127.0.0.1:6379> ttl -C7pZ9Dsy3:IvlhTR68
(integer) 42662
127.0.0.1:6379> keys *
(empty array)
# free -m
total used free shared buff/cache available
Mem: 981 700 68 14 212 114
Swap: 1023 555 468
redis:
image: redis:6.0.1
ports:
- 6379:6379
volumes:
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf
- ./redis/volume/:/data
networks:
- symfony
command: [ "redis-server"]
redis_1 | 1:S 26 Jan 2021 11:50:57.299 * MASTER <-> REPLICA sync started
redis_1 | 1:S 26 Jan 2021 11:50:57.311 * Non blocking connect for SYNC fired the event.
redis_1 | 1:S 26 Jan 2021 11:50:58.392 # Module /tmp/exp_lin.so failed to load: It does not have execute permissions.
redis_1 | 1:M 26 Jan 2021 11:50:58.404 # Setting secondary replication ID to fc47e2e4f5487fa786ef9103d6033f6b393a393b, valid up to offset: 1. New replication ID is 015a93b3ff96075a9edd685787a0dea81adf88cc
redis_1 | 1:M 26 Jan 2021 11:50:58.405 * MASTER MODE enabled (user request from 'id=85 addr=188.166.115.185:12036 fd=9 name= age=5 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=34 qbuf-free=32734 obl=0 oll=0 omem=0 events=r cmd=slaveof user=default')
redis_1 | 1:M 26 Jan 2021 12:00:16.046 * 1 changes in 3600 seconds. Saving...
redis_1 | 1:M 26 Jan 2021 12:00:16.050 * Background saving started by pid 24
redis_1 | 24:C 26 Jan 2021 12:00:16.053 * DB saved on disk
redis_1 | 24:C 26 Jan 2021 12:00:16.054 * RDB: 0 MB of memory used by copy-on-write
redis_1 | 1:M 26 Jan 2021 12:00:16.150 * Background saving terminated with success
Answer the question
In order to leave comments, you need to log in
Check the VPS log.
How long did it take for the post to disappear? More than 10 minutes? Is there anything in the container log during this time?
Most likely the memory is full.
Try to prescribe in redis.conf maxmemory less than half of the available 1GB.
Also, I'm trying to create a build based on the downloaded redis.conf file in which maxmemory is specified,
now when you start
127.0.0.1:6379> config get maxmemory
1) "maxmemory"
2) "128000000"
initially the memory is already set, but the data is not written to the radish
Redis needs to be started with the following command - redis-server --appendonly yes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question