The installed redis will fail to connect every once in a while

Recently, redis is used as a buffered database, but after a period of time, the connection will not be realized, but the port of redis can be connected to redis using telnet, and reids can be connected locally through redis-cli . By using the ping command in the cli, the result reported the following error:

(error) 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.

 

Translation: Redis is configured to save database snapshots, but it cannot currently persist to disk. Commands used to modify collection data cannot be used. Please check the Redis log for detailed error messages.

 

Reason: Redis snapshot cannot be persisted due to forcibly closed.

 

Check the online solution: Modify stop-writes-on-bgsave-error in the redis-conf configuration file to no

 

However, after the modification, the same error was reported after a period of time. Later, when the redis-server was opened, an error message appeared:

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.overcommit_memory=1' for this to take effect.

The reason is insufficient memory. (When I started to read this error message, I used free -m to check the memory usage of the system, and found that there was more than 800 M of memory left. I thought it was not a memory problem. Later, I found that redis saves data and guides it to the hard disk. When the process of the same size is copied to save data specially, that is to say, if the main process of redis occupies 400M of memory, then 800M is needed for copying)

 

The solution prompt has been given: modify the value of vm .overcommit_memory in /etc/sysctl.conf to 1, then use sysctl -p to make the modification take effect, and then restart redis

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326928997&siteId=291194637