In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Redis: Can't save in background: fork: Cannot allocate memory
JAVA program error message:
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
View the redis log:
18793:S 02 Dec 10:02:02.069 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:02:08.088 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:02:14.006 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:02:20.021 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:02:26.038 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:02:32.054 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:02:38.067 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:02:44.086 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:02:50.002 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:02:56.017 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:03:02.037 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:03:08.056 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:03:14.073 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:03:20.091 # Can't save in background: fork: Cannot allocate memory
18793:S 02 Dec 10:03:26.007 # Can't save in background: fork: Cannot allocate memory
Data writeback is divided into synchronous and asynchronous methods:
Synchronous writeback (SAVE), where the main process writes back data directly to the disk. In the case of a large amount of data, it will cause the system to die for a long time.
Asynchronous writeback (BGSAVE). After the main process fork, copy itself and write back to the disk through this new process. After the writeback ends, the new process shuts down itself.
Because BGSAVE does not need main process blocking and the system will not fake death, BGSAVE is generally used to realize data write-back.
Redis starts the token child process when dump data. Due to insufficient memory, the disk cannot be persisted.
Redis has a default option:
Stop-writes-on-bgsave-error yes
By default, if there is a problem during RDB snapshots persistence, Redis does not allow users to do any updates after setting this parameter.
The incomplete solution is to change this option to false
Stop-writes-on-bgsave-error false
But this only allows the user to continue to update when redis writes a snapshot of the hard disk, but it still fails to write to the hard disk.
Complete solution: directly modify the kernel parameter vm.overcommit_memory = 1
Edit file / etc/sysctl.conf add:
Vm.overcommit_memory=1
Execute sysctl-p to make it effective
The Linux kernel decides whether to release or not based on the setting of the parameter vm.overcommit_memory parameter.
Vm.overcommit_memory = 1, direct release
Vm.overcommit_memory = 2: all the virtual memory allocated by the process plus the virtual memory allocated by this request is compared with the system's current free physical memory plus swap to decide whether to release it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.