Predis\Response\ServerException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
laravel错误日志:
[2023-03-14 04:48:04] local.ERROR: Predis\Response\ServerException:
MISCONF Redis is configured to save RDB snapshots,
but is currently not able to persist on disk.
Commands that may modify the data set are disabled.
Please check Redis logs for details about the error.
in /vendor/predis/predis/src/Client.php:370
redis错误日志:
8302:M 14 Mar 08:57:20.098 * 10 changes in 300 seconds. Saving...
8302:M 14 Mar 08:57:20.098 # Can't save in background: fork: Cannot allocate memory
8302:M 14 Mar 08:57:26.014 * 10 changes in 300 seconds. Saving...
8302:M 14 Mar 08:57:26.014 # Can't save in background: fork: Cannot allocate memory
8302:M 14 Mar 08:57:32.027 * 10 changes in 300 seconds. Saving...
8302:M 14 Mar 08:57:32.027 # Can't save in background: fork: Cannot allocate memory
8302:M 14 Mar 08:57:38.036 * 10 changes in 300 seconds. Saving...
8302:M 14 Mar 08:57:38.066 * Background saving started by pid 20629
20629:C 14 Mar 08:57:49.547 * DB saved on disk
20629:C 14 Mar 08:57:49.570 * RDB: 1 MB of memory used by copy-on-write
8302:M 14 Mar 08:57:49.666 * Background saving terminated with success
8302:M 14 Mar 09:02:50.013 * 10 changes in 300 seconds. Saving...
8302:M 14 Mar 09:02:50.044 * Background saving started by pid 21545
21545:C 14 Mar 09:03:01.194 * DB saved on disk
21545:C 14 Mar 09:03:01.229 * RDB: 1 MB of memory used by copy-on-write
8302:M 14 Mar 09:03:02.210 * Background saving terminated with success
8302:M 14 Mar 09:08:03.063 * 10 changes in 300 seconds. Saving...
8302:M 14 Mar 09:08:03.063 # Can't save in background: fork: Cannot allocate memory
8302:M 14 Mar 09:08:09.077 * 10 changes in 300 seconds. Saving...
8302:M 14 Mar 09:08:09.077 # Can't save in background: fork: Cannot allocate memory
8302:M 14 Mar 09:08:15.092 * 10 changes in 300 seconds. Saving...
8302:M 14 Mar 09:08:15.092 # Can't save in background: fork: Cannot allocate memory
Can't save in background: fork: Cannot allocate memory(翻译过来就是无法分配更多的内存)
排查方向:
1.设置redis可用内存过低,需要往高去设置
2.服务器内存过低,排查其他占用内存高的进程,讨论出方案后实施迁移到其他服务器或者服务器升配
3.redis是否频繁添加数据,如果是这个问题,需要优化代码或修改redis密码(我这边是这个问题)