redis的本地化储存问题
ringa_lee
ringa_lee 2017-04-21 10:57:11
0
2
684

1.是不是在配置文件中设置了类似:

save 60 1000 

就会让redis定时自动的保存数据?

2.如果发生意外断电或者有计划的重启,数据是自动恢复还是需要我手动去操作(假设已经配置好rediss随系统自启动)?如果需要手动操作,具体如何做?

ringa_lee
ringa_lee

ringa_lee

reply all(2)
伊谢尔伦

Please take a good look at the official documents, there aren’t many.

1. save 60 1000 means that if there are more than 1000 write requests within 60 seconds, redis will call fsync once to ensure that the data is written back to the disk.

For example, this configuration will make Redis automatically dump the dataset to disk every 60 seconds if at least 1000 keys changed:

save 60 1000

2. Depends on whether you use AOF or RDB mode. The AOF mode (actually the log of all requests) will be automatically rebuilt (but it is very slow because it has to start from scratch), while the RDB mode may cause file corruption (so the official recommendation is regular backup).

巴扎黑

Like @felix021
However, in @felix021’s answer, save 60 1000, this should mean that fsync is executed once for at least 1000 requests within 60 seconds

It is recommended to use regular backup of RDB files to ensure data security. At the same time, you can use aof mode to ensure that data is not lost.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!