redis重启之后丢失数据

来源:互联网 发布:粤语软件哪个好 编辑:程序博客网 时间:2024/05/22 14:20



小狼在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 1save 300 10save 60 10000 2)# The filename where to dump the DBdbfilename dump.rdb 3)# Note that you must specify a directoryhere, not a file name.dir ./



第三步  

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

成功解决问题,点个赞

1 0