There was an error running Redis today with the following error message:
(Error) Misconf Redis is configured to save the RDB snapshots, but was currently not able to persist on disk. Commands that may modify the data set is disabled. Please check your Redis logs for details about the error.
Redis is configured to save a database snapshot, but it cannot be persisted to the hard disk at this time. The command used to modify collection data is not available. Please review the detailed error information for the Redis log.
Reason:
Forcing a Redis snapshot to close causes it to not persist.
Solution:
1. After running the config set stop-writes-on-bgsave-error no command, close the configuration item Stop-writes-on-bgsave-error resolve the issue.
[Email protected]:/usr/local/redis/bin#./redis-cli
127.0.0.1:6379> Config set Stop-writes-on-bgsave-error no
Ok
127.0.0.1:6379> lpush mycolour "Red"
(integer) 1
2, Window under Modify: redis.windows-service.conf
Found: Stop-writes-on-bgsave-error Yes modified to No, then restart service
Find another solution on the Web:
Today's second encounter with Redis "Misconf Redis is configured to save the RDB snapshots, but was currently not able to persist on disk" issue. This error message is the exception information that the Redis client tool throws when it saves data.
Online check, many people are recommended "config set Stop-writes-on-bgsave-error no". This is not good, this is simply to let the program ignore the exception, so that the program can continue to run, but the actual data will still be stored to the hard disk failure!
The last time you encounter this problem is because a bug in the program caused the system memory to be exhausted, and then fixed the bug solved. Look at the system memory at the time of the problem today and about 2GB, "it feels like it's not Memory" (later discovered or because of memory).
Because Redis is running in daemon mode, you can't see the detailed logs. Modify the profile settings logfile parameter to the file (the default is stdout, it is recommended to modify this parameter after installation, otherwise you will lose a lot of important information), restart Redis, view the log, see the program starts with a line of warning:
"WARNING Overcommit_memory is set to 0!" Background save may fail under low memory condition. To fix this issue add ' vm.overcommit_memory = 1 ' to/etc/sysctl.conf and then reboot or run the command ' Sysctl vm.overcom Mit_memory=1 ' for the take effect. " (Warning: Excessive use of memory is set to 0!) In a low-memory environment, background saving may fail. To fix this problem, add a ' vm.overcommit_memory = 1 ' in/etc/sysctl.conf and then restart (or run the command ' Sysctl Vm.overcommit_memory=1 ') to take effect. )
When I didn't understand the meaning, I ignored it. After starting the Redis client, the program continues to report "Misconf Redis is configured to save RDB snapshots, and is currently not able to persist on disk" exception, Then look at the Redis logs and see the error "Can ' t save in Background:fork:Cannot allocate memory", the hint is obvious "the fork process is not enough RAM!" "(Still a memory problem).
By Google query "Can ' t save in Background:fork:Cannot allocate memory" this hint, found the solution:
View Plaincopy to Clipboardprint?
- Original: http://pydelion.com/2013/05/27/redis-cant-save-in-background-fork-cannot-allocate-memory/
- If you get the This error
- Can ' t save in Background:fork:Cannot allocate memory
- It means that your the current database is bigger than memory. To fix the issue enable Vm.overcommit_memory:
- Sysctl vm.overcommit_memory=1
- To has if after reboot add this line to/etc/sysctl.cnf:
- vm.overcommit_memory=1
The problem is solved after modifying Vm.overcommit_memory=1.
Why does the system still have 2GB of memory left, Redis will say that memory is not enough?
Online check, some people have encountered similar problems, and gave a very good analysis (see: Http://www.linuxidc.com/Linux/2012-07/66079.htm), simply: Redis to save data to the hard disk in order to avoid the main process of suspended animation, Need to fork a copy of the main process, and then in the fork process to save the data to the hard disk operation, if the main process uses 4GB of memory, fork sub-process when the need for additional 4GB, when the memory is not enough, fork failed, and then the data saved hard disk also failed.
Http://www.redicecn.com/html/Linux/20131125/468.html
(Error) Misconf Redis is configured to save the RDB snapshots, but was currently not able to persist on disk.