Solve the problem of data loss when redis restarts in linux

In the Linux system, Redis originally had data, but after the Linux system restarts, all the data in Redis is lost. After several tests, it is the same, only when the Linux system is restarted will it be lost, and there should be no problem with Redis restarting.

This problem only exists in Linux systems, and there is no problem in Windows systems.

2. SolutionsIt can be solved by setting a parameter (vm.overcommit_memory) 
in the Linux system .
Proceed as follows:
1. Edit the sysctl.conf configuration file

    vi / etc / sysctl. conf  


2. Add the parameter vm.overcommit_memory configuration in another line, as follows

     vm.overcommit_memory = 1  


3. Make the configuration file take effect

    sysctl -p  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325290770&siteId=291194637