Linux Redis restart data loss solution, Redis data loss solution after Linux restart

Linux Redis restart data loss solution, Redis data loss solution after Linux restart

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

©Copyright Sweet Potato Yao July 22, 2017

http://fanshuyao.iteye.com/

 

1. Description of the problem

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. Solutions

It 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

 

This is the end, add some data to Redis, and then restart the Linux system to check whether the data is lost.

After my own test, the data is not lost in the end, which solves the problem of Redis data loss after Linux restarts

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

©Copyright Sweet Potato Yao July 22, 2017

http://fanshuyao.iteye.com/

Guess you like

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