Redis配置文件(2)SNAPSHOTTING快照/APPEND ONLY MODE追加
redis.conf文件
RDB是整个内存的压缩过的Snapshot,RDB的数据结构,可以配置复合的快照触发条件,
默认
是1分钟内改了1万次,
或5分钟内改了10次,
或15分钟内改了1次。
b.如果想禁用RDB持久化的策略,只要不设置任何save指令,或者给save传入一个空字符串参数也可以
# Note: you can disable saving completely by commenting out all "save" lines.
#
# It is also possible to remove all the previously configured save
# points by adding a save directive with a single empty string argument
# like in the following example:
#
200 # save ""
save
save
save
set key value1 save
此时立马执行,形成最新的dump文件
# However if you have setup your proper monitoring of the Redis server
# and persistence, you may want to disable this feature so that Redis will
# continue to work as usual even if there are problems with disk,
# permissions, and so forth.
stop-writes-on-bgsave-error yes
yes:出错了就立即停止
# Compress string objects using LZF when dump .rdb databases?
# For default that's set to 'yes' as it's almost always a win.
# If you want to save some CPU in the saving child set it to 'no' but
# the dataset will likely be bigger if you have compressible values or keys.
rdbcompression yes
dbfilename
默认生成的rdb文件名
# The filename where to dump the DB
dbfilename dump.rdb
dir
# Note that you must specify a directory here, not a file name.
dir ./
实战测试:
修改配置文件
# save ""
save
203 save 120 10
save
两分钟10次操作

之后会生成一个dump.rdb文件,具体生成文件的默认名请修改:dbfilename
进行复制(备份)

模拟事故:
此时直接删除所有的数据

此时再次重新登陆则是会显示为空,即是存在dump.rdb文件



APPEND ONLY MODE追加
appendonly:默认开关状态,可以同时和RDB一起开着
# AOF and RDB persistence can be enabled at the same time without problems.
# If the AOF is enabled on startup Redis will load the AOF, that is the file
# with the better durability guarantees.
#
# Please check http://redis.io/topics/persistence for more information. appendonly no
默认是关着的
appendfilename:默认的文件名
# The name of the append only file (default: "appendonly.aof")
appendfilename "appendonly.aof"
appendfsync
# no: don't fsync, just let the OS flush the data when it wants. Faster.
# always: fsync after every write to the append only log. Slow, Safest.
# everysec: fsync only one time every second. Compromise.
always:同步持久话每次发生数据变更立即记录到磁盘,性能比较差但是数据完整性好
everysec:出场默认的推荐的,异步操作,每秒记录,如果一秒内宕机,有数据丢失
# More details please check the following article:
# http://antirez.com/post/redis-persistence-demystified.html
# If unsure, use "everysec".
# appendfsync always
appendfsync everysec
# If you have latency problems turn this to "yes". Otherwise leave it as
# "no" that is the safest pick from the point of view of durability.
no-appendfsync-on-rewrite no
# This base size is compared to the current size. If the current size is
# bigger than the specified percentage, the rewrite is triggered. Also
# you need to specify a minimal size for the AOF file to be rewritten, this
# is useful to avoid rewriting the AOF file even if the percentage increase
# is reached but it is still pretty small.
# Specify a percentage of zero in order to disable the automatic AOF
# rewrite feature.
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
# Please check http://redis.io/topics/persistence for more information.
appendonly yes

创造性的意外事件






此时RDB和AOF文件都在

此时启动Redis

在dump.rdb文件完整的情况下,appendonly.aof文件出错,说明后者的优先级大于前者
那么此时的处理方式是:
redis-check-aof --fix appendonly.aof

再次重新启动:

Redis配置文件(2)SNAPSHOTTING快照/APPEND ONLY MODE追加的更多相关文章
- Redis 配置文件详解
# Redis 配置文件 # 当配置中需要配置内存大小时,可以使用 1k, 5GB, 4M 等类似的格式,其转换方式如下(不区分大小写)## 1k => 1000 bytes# 1kb => ...
- redis配置文件
# redis 配置文件示例 # 当你需要为某个配置项指定内存大小的时候,必须要带上单位, # 通常的格式就是 1k 5gb 4m 等酱紫: # # 1k => bytes # 1kb => ...
- redis配置文件中文解释
# redis 配置文件示例 # 当你需要为某个配置项指定内存大小的时候,必须要带上单位, # 通常的格式就是 1k 5gb 4m 等酱紫: # # 1k => bytes # 1kb => ...
- Redis配置文件 翻译 V3.2版本
# Redis配置文件例子. # # 注意:为了能读取到配置文件,Redis服务必须以配置文件的路径作为第一个参数启动 # ./redis-server /path/to/redis.conf # 关 ...
- 4 Redis 配置文件介绍
2016-12-22 14:28:39 该系列文章链接NoSQL 数据库简介Redis的安装及及一些杂项基础知识Redis 的常用五大数据类型(key,string,hash,list,set,zse ...
- windows下redis 配置文件参数说明
1.先看redis.windows.conf 文件 # Redis configuration file example # Note on units: when memory size is ne ...
- 最详细最全的redis配置文件解释
转载自:http://www.cnblogs.com/zhang-ke/p/5981108.html #redis.conf# Redis configuration file example.# . ...
- redis 配置文件示例
# redis 配置文件示例 # 当你需要为某个配置项指定内存大小的时候,必须要带上单位,# 通常的格式就是 1k 5gb 4m 等酱紫:## 1k => 1000 bytes# 1kb =& ...
- NoSQL入门第三天——Redis配置文件与持久化
一.解析Redis配置文件redis.conf (Linux下配置多于编码) 1.它在哪 由于我是在root的家目录下载安装的,默认的安装位置就是: conf就在这里: 根据经验,出厂的conf永远不 ...
随机推荐
- C# 页面抽奖实例 asp.net
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat=&qu ...
- 02.ToString()方法详解
ToString()使用方法汇总(C#) C 货币 2.5.ToString("C") ¥2.50 D 十进制数 25.ToString("D5") 00025 ...
- 2017年12月13日 LinQ用法基本的增删改查
LinQ是什么? LinQ是语言集成的查询,是用于C#跟Vb的扩展语言 LinQ的用法 新建一个App_Code文件夹,在文件夹下添加一个数据LinQ to SQL类,可以直接直接点击服务器管理器然后 ...
- java类与对象基础--抽象类和接口
在java的类体系中,有两个比较特殊的抽象体--抽象类和接口.抽象体并不可以拥有具体的对象(而且接口甚至不是类),但是它们却是在java设计领域非常重要的两个概念,很多优秀的设计模式都是基于这两个概念 ...
- Hibernate 性能优化一对一关联映射
概述: hibernate提供了两种映射一对一关联的方式:按照外键映射和按照主键映射. 下面以员工账号和员工档案为例 ,介绍两种映射方式,并使用这两种映射方式分别完成以下持久化操作: (1)保存员工档 ...
- package.json中版本理解
一个完整的版本号可以理解为: [主要版本号,次要版本号,补丁版本号]版本号 x.y.z :其中z 表示一些小的bugfix, y表示一些大的版本更改,比如一些API的变化x表示一些设计的变动及模块的重 ...
- eclipse svn使用
简单介绍一些基本操作 1.同步在Eclipse下,右击你要同步的工程->team->与资源库同步->这时会进入同步透视图,会显示出本机与SVN上内容有不同的文件,双击文件名,会显示出 ...
- 01_Jdk自带SPI
[SPI的设计目标] 面向对象的设计里,模块之间是基于接口编程,模块之间不对实现类进行硬编码. 一旦代码里设计具体的实现类,就违法了可插拔的原则,如果需要替代一种实现,就要修改代码. 为了实现在模块装 ...
- Python爬虫教程-16-破解js加密实例(有道在线翻译)
python爬虫教程-16-破解js加密实例(有道在线翻译) 在爬虫爬取网站的时候,经常遇到一些反爬虫技术,比如: 加cookie,身份验证UserAgent 图形验证,还有很难破解的滑动验证 js签 ...
- SpringMVC学习(六)——@InitBinder注解
有些类型的数据是无法自动转换的,比如请求参数中包含时间类型的数据,无法自动映射到Controller里的Date参数.需要使用@initBinder注解为binder提供一个数据的转换器,这个转换器可 ...