我的redis安装似乎使用了大量的磁盘空间。它看起来主要来自这些临时的rdb文件。删除它们安全吗?还有,我可以配置Redis自动删除它们吗?
$ ls -lahS
-rw------- 1 root root 18G Aug 10 05:21 temp-23.rdb
-rw------- 1 root root 13G Aug 10 06:06 temp-17.rdb
-rw------- 1 root root 13G Aug 10 02:39 temp-49.rdb
-rw------- 1 root root 8.9G Oct 1 03:47 dump.rdb
-rw------- 1 root root 8.4G Aug 10 07:40 temp-14.rdb
-rw------- 1 root root 8.1G Aug 11 07:10 temp-764.rdb
-rw------- 1 root root 7.1G Oct 1 06:27 temp-16736.rdb
-rw------- 1 root root 5.3G Aug 10 04:00 temp-26.rdb
-rw------- 1 root root 4.4G Aug 11 06:27 temp-24139.rdb
-rw------- 1 root root 1.1G Aug 10 08:22 temp-1.rdb
-rw------- 1 root root 356M Oct 1 07:29 temp-1132.rdb
-rw------- 1 root root 86M Aug 10 07:45 temp-15.rdb
-rw------- 1 root root 35M Oct 1 09:02 temp-1700.rdb
-rw------- 1 root root 4.9M Aug 11 15:49 temp-8773.rdb
drwxr-xr-x 2 999 docker 4.0K Oct 1 09:02 .
drwx-----x 3 root root 4.0K May 11 18:11 ..
-rw-r--r-- 1 root root 58 Aug 10 08:25 redis.conf
$ cat redis.conf
maxmemory 16gb
maxmemory-policy allkeys-lfu
bind 0.0.0.0
Dockerfile:
FROM redis:7
HEALTHCHECK CMD \
bash -c 'redis-cli -a $REDIS_PASSWORD ping | grep PONG'
CMD bash -c 'redis-server /data/redis.conf --requirepass $REDIS_PASSWORD'
Redis日志:
9:C 01 Oct 2023 09:35:54.204 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
9:C 01 Oct 2023 09:35:54.204 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
9:C 01 Oct 2023 09:35:54.204 * Redis version=7.2.1, bits=64, commit=00000000, modified=0, pid=9, just started
9:C 01 Oct 2023 09:35:54.204 * Configuration loaded
9:M 01 Oct 2023 09:35:54.204 * monotonic clock: POSIX clock_gettime
9:M 01 Oct 2023 09:35:54.205 * Running mode=standalone, port=6379.
9:M 01 Oct 2023 09:35:54.205 * Server initialized
9:M 01 Oct 2023 09:35:54.206 * Loading RDB produced by version 7.0.12
9:M 01 Oct 2023 09:35:54.206 * RDB age 20998 seconds
9:M 01 Oct 2023 09:35:54.206 * RDB memory usage when created 16226.76 Mb
9:M 01 Oct 2023 09:36:36.622 * Done loading RDB, keys loaded: 532764, keys expired: 0.
9:M 01 Oct 2023 09:36:36.623 * DB loaded from disk: 42.417 seconds
9:M 01 Oct 2023 09:36:36.623 * Ready to accept connections tcp
1条答案
按热度按时间5vf7fwbs1#
除了dump.rdb,你可以删除其他临时文件。关于自动删除功能,我不确定它是否在redis中。您需要设置一个cron作业以定期删除