Redis - 无法打开.rdb进行保存:权限被拒绝

时间:2017-05-24 04:51:30

标签: redis

我使用的是redis 3.0.6版。 redis用户正在运行redis-server进程。

突然从24小时后的5天开始,redis开始失败"打开.rdb进行保存。"在此之前它正常运作。

正如您在下面的日志片段中看到的那样,Redis表现正常,然后开始失败。稍后重新启动服务器解决了这个问题。

1427:M 24 May 01:09:05.102 * Background saving started by pid 2493    
2493:C 24 May 01:09:34.916 * DB saved on disk
2493:C 24 May 01:09:34.917 * RDB: 310 MB of memory used by copy-on-write
1427:M 24 May 01:09:34.950 * Background saving terminated with success
1427:M 24 May 01:14:35.026 * 10 changes in 300 seconds. Saving...
1427:M 24 May 01:14:35.036 * Background saving started by pid 2494
2494:C 24 May 01:15:04.329 * DB saved on disk
2494:C 24 May 01:15:04.330 * RDB: 298 MB of memory used by copy-on-write
1427:M 24 May 01:15:04.408 * Background saving terminated with success
1427:M 24 May 01:20:05.008 * 10 changes in 300 seconds. Saving...
1427:M 24 May 01:20:05.018 * Background saving started by pid 2499
2499:C 24 May 01:20:33.830 * DB saved on disk
2499:C 24 May 01:20:33.831 * RDB: 330 MB of memory used by copy-on-write
1427:M 24 May 01:20:33.843 * Background saving terminated with success
1427:M 24 May 01:23:46.966 # Failed opening .rdb for saving: Read-only file system
1427:M 24 May 01:25:34.029 * 10 changes in 300 seconds. Saving...
1427:M 24 May 01:25:34.038 * Background saving started by pid 2500
2500:C 24 May 01:25:34.038 # Failed opening .rdb for saving: Read-only file system
1427:M 24 May 01:25:34.139 # Background saving error
1427:M 24 May 01:25:40.059 * 10 changes in 300 seconds. Saving...
1427:M 24 May 01:25:40.064 * Background saving started by pid 2501
2501:C 24 May 01:25:40.064 # Failed opening .rdb for saving: Read-only file system
1427:M 24 May 01:25:40.165 # Background saving error
1427:M 24 May 01:25:46.080 * 10 changes in 300 seconds. Saving...
1427:M 24 May 01:25:46.085 * Background saving started by pid 2502
2502:C 24 May 01:25:46.085 # Failed opening .rdb for saving: Read-only file system
1427:M 24 May 01:25:46.186 # Background saving error
1427:M 24 May 01:25:52.100 * 10 changes in 300 seconds. Saving...
1427:M 24 May 01:25:52.105 * Background saving started by pid 2503
2503:C 24 May 01:25:52.105 # Failed opening .rdb for saving: Read-only file system
1427:M 24 May 01:25:52.206 # Background saving error

所以,我的问题:这怎么可能发生? 请给我适当的解决方案。

3 个答案:

答案 0 :(得分:4)

我认为“只读文件系统”是关键所在。它尝试写入的设备可能安装不正确,但由于它是随机发生的,系统可能会强制文件系统进入只读模式。有许多条件可以触发操作系统将文件系统置于只读模式。这可能意味着文件系统已损坏或存在其他一些文件系统一致性问题。如果您在云提供商上托管并且该磁盘在AWS中像EBS一样受网络支持,则可以通过临时网络问题触发。有时问题是暂时的,要么重新安装分区(或重启服务器)将解决问题。其他时候它是永久性的,但由于你的服务器恢复正常,情况似乎并非如此。但真正解决的问题在于您的硬件设置并不详细。

这个答案与“为什么”:Failed opening the RDB file ... Read-only file system

有关

答案 1 :(得分:0)

升级后..(Ubuntu 14.04 LTS)

我曾对此感到再抱怨。.文件系统不是RO。很好。

  

kill -9 REDIS-PROCESS#否则它不会死。循环显示错误。

删除了已经存在的dump.rdb文件。

再次启动REDIS,问题似乎消失了。 (我只是这样做了。所以事情可能会回来。)

似乎是升级问题。

答案 2 :(得分:0)

  1. 您可以检查您的redis.conf,在此配置文件中,您可以找到dbfilename所在的位置,

  2. 授予包含dbfilename的权限755'dir',它是/ var / lib / redis(centos), 并将用户和组设置为“ redis”,但目录中的文件应为644。

  3. 重新启动Redis。