解決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