【发布时间】:2020-05-30 04:00:30
【问题描述】:
Redis 将自己的配置目录更改为 /etc/cron.d 并将 dbfile 更改为 ntp 而不是默认配置。一旦我们重新启动redis,它将重置为/var/lib/redis 和dump.rdb,但过了一会儿,它会出现“打开RDB 文件失败”错误
默认的 dire 和 rdb 文件具有正确的权限,redis 仅允许内部 IP。
cli 输出
127.0.0.1:6381> CONFIG GET dir
1) "dir"
2) "/etc/cron.d"
127.0.0.1:6381> CONFIG GET "dbfilename"
1) "dbfilename"
2) "ntp"
/var/log/redis/redis-server.log
3204:M 21 May 16:07:19.124 * Background saving terminated with success
3204:M 21 May 16:12:18.962 * 10000 changes in 60 seconds. Saving...
3204:M 21 May 16:12:18.967 * Background saving started by pid 25469
25469:C 21 May 16:12:20.931 * DB saved on disk
25469:C 21 May 16:12:20.934 * RDB: 3 MB of memory used by copy-on-write
3204:M 21 May 16:12:20.968 * Background saving terminated with success
3204:M 21 May 16:17:21.082 * 10 changes in 300 seconds. Saving...
3204:M 21 May 16:17:21.088 * Background saving started by pid 25865
25865:C 21 May 16:17:22.800 * DB saved on disk
25865:C 21 May 16:17:22.803 * RDB: 3 MB of memory used by copy-on-write
3204:M 21 May 16:17:22.891 * Background saving terminated with success
3204:M 21 May 16:17:43.669 # Failed opening the RDB file root (in server root dir /var/spool/cron) for saving: Read-only file system
3204:M 21 May 16:17:45.320 # Failed opening the RDB file ntp (in server root dir /etc/cron.d) for saving: Read-only file system
3204:M 21 May 16:22:23.086 * 10 changes in 300 seconds. Saving...
3204:M 21 May 16:22:23.092 * Background saving started by pid 26264
26264:C 21 May 16:22:23.093 # Failed opening the RDB file ntp (in server root dir /etc/cron.d) for saving: Read-only file system
3204:M 21 May 16:22:23.194 # Background saving error
3204:M 21 May 16:22:29.104 * 10 changes in 300 seconds. Saving...
3204:M 21 May 16:22:29.109 * Background saving started by pid 26265
26265:C 21 May 16:22:29.109 # Failed opening the RDB file ntp (in server root dir /etc/cron.d) for saving: Read-only file system
3204:M 21 May 16:22:29.209 # Background saving error
3204:M 21 May 16:22:35.016 * 10 changes in 300 seconds. Saving...
【问题讨论】:
-
您是否在此处查看过类似问题:github.com/antirez/redis/issues/3594# 看起来这可能是某人的攻击。您是否尝试升级您的 Redis(您实际使用的是哪个版本?)或禁用 CONFIG 命令?
-
很好的提示,谢谢! @Pampy 真正解决了我的问题的答案。我们将配置绑定到多个地址
bind 127.0.0.1 10.105.2.5(仅允许用于内部 IP)。但是,一个实例是可公开访问的。一旦我们删除 127.0.0.1,问题就解决了。
标签: redis ubuntu-18.04