U
U
user98232021-01-26 15:43:13
Redis
user9823, 2021-01-26 15:43:13

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"


checking TTL
127.0.0.1:6379> ttl -C7pZ9Dsy3:IvlhTR68
(integer) 42662


those. everything seems to be working well, the key will have to end in 42662 seconds. (about 12 o'clock)
Then something happens and the radish is clean.
I don’t send any requests to him, the radish is completely clean. I check it.
127.0.0.1:6379> keys *
(empty array)


the server is running on Digital Ocean. The server is weak, 1 GB of RAM I will
check the memory
# free -m
              total        used        free      shared  buff/cache   available
Mem:            981         700          68          14         212         114
Swap:          1023         555         468


conf is thrown into volume. file (piece from docker-compose)
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"]


where to dig? what to watch?
doing docker-compose logs redis the
last lines are
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


I guess that's it * RDB: 0 MB of memory used by copy-on-write
how to fix it? who has any thoughts? thanks in advance for your reply

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vitaly Karasik, 2021-01-27
@vitaly_il1

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?

W
wazza, 2021-01-27
@wazza

Most likely the memory is full.
Try to prescribe in redis.conf maxmemory less than half of the available 1GB.

U
user9823, 2021-01-27
@user9823

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

D
Denis Verbin, 2021-01-27
@rez0n

Redis needs to be started with the following command - redis-server --appendonly yes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question