解决redis重启后数据丢失


第一步

       在redis配置文件中添加如下配置

 

redis 127.0.0.1:6380> config get*append* 1) "appendonly" 2) "yes" 3) "no-appendfsync-on-rewrite" 4) "no" 5) "appendfsync" 6) "everysec" redis 127.0.0.1:6380> config get*aof* 1) "auto-aof-rewrite-percentage" 2) "100" 3) "auto-aof-rewrite-min-size" 4) "67108864"

 

第二步  在redis配置文件中添加如下配置,重启服务

 

1) # save "" save 900 1 save 300 10 save 60 10000 2) # The filename where to dump the DB dbfilename dump.rdb 3) # Note that you must specify a directoryhere, not a file name. dir ./

 

 

第三步  

编辑/etc/sysctl.conf ,改vm.overcommit_memory=1,然后sysctl -p 使配置文件生效

成功解决问题,点个赞


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM