惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
SecWiki News
SecWiki News
Project Zero
Project Zero
C
Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Scott Helme
Scott Helme
A
Arctic Wolf
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
The Hacker News
The Hacker News
T
Tenable Blog
雷峰网
雷峰网
有赞技术团队
有赞技术团队
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threat Research - Cisco Blogs
T
Threatpost
AWS News Blog
AWS News Blog
L
LINUX DO - 热门话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
SegmentFault 最新的问题
月光博客
月光博客
Spread Privacy
Spread Privacy
S
Secure Thoughts
宝玉的分享
宝玉的分享
博客园 - 三生石上(FineUI控件)
Forbes - Security
Forbes - Security
T
The Exploit Database - CXSecurity.com
G
GRAHAM CLULEY
The Last Watchdog
The Last Watchdog
Y
Y Combinator Blog
I
Intezer
博客园 - 【当耐特】
B
Blog RSS Feed
Attack and Defense Labs
Attack and Defense Labs
I
InfoQ
博客园 - 叶小钗
Cyberwarzone
Cyberwarzone
V2EX - 技术
V2EX - 技术
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hugging Face - Blog
Hugging Face - Blog
H
Help Net Security
C
CERT Recently Published Vulnerability Notes

博客园 - PointNet

log4j2发送消息至Kafka log4j2自定义Appender(输出到文件/RPC服务中) log4j 不同模块输出到不同的文件 shell之磁盘容量检查,配合crontab可以定时清理磁盘 spring注解之@profile How to do conditional auto-wiring in Spring? MyBatis传入参数为集合 list 数组 map写法 Spring Boot @Autowired 没法自动注入的问题 mysql5.5 uuid做主键与int做主键的性能实测 dom4j解析xml字符串实例 spring自动注入是单例还是多例?单例如何注入多例? Spring中Bean的五个作用域 【总结】瞬时高并发(秒杀/活动)Redis方案 浅谈分布式事务 基于Redis实现分布式锁 MySQL事务隔离级别详解 Redis学习手册(Sorted-Sets数据类型) Redis - 事务 ArrayList、Vector、HashMap、HashTable、HashSet的默认初始容量、加载因子、扩容增量
Redis的快照持久化-RDB与AOF
PointNet · 2017-08-23 · via 博客园 - PointNet

 Redis持久化功能

  Redis为了内部数据的安全考虑,会把本身的数据以文件形式保存到硬盘中一份,在服务器重启之后会自动把硬盘的数据恢复到内存(redis)的里边。

数据保存到硬盘的过程就称为“持久化”效果。

1. snap shotting快照持久化

该持久化默认开启,一次性把redis中全部的数据保存一份存储在硬盘中,如果数据非常多(10-20G)就不适合频繁进行该持久化操作。

下方是快照持久化在本地硬盘保留的数据备份文件(redis自动生成):

查看快照持久化的备份频率(打开redis.conf):

  1. ################################ SNAPSHOTTING  #################################  
  2. #  
  3. # Save the DB on disk:  
  4. #  
  5. #   save <seconds> <changes>  
  6. #  
  7. #   Will save the DB if both the given number of seconds and the given  
  8. #   number of write operations against the DB occurred.  
  9. #  
  10. #   In the example below the behaviour will be to save:  
  11. #   after 900 sec (15 min) if at least 1 key changed  
  12. #   after 300 sec (5 min) if at least 10 keys changed  
  13. #   after 60 sec if at least 10000 keys changed  
  14. #  
  15. #   Note: you can disable saving at all commenting all the "save" lines.  
  16. #  
  17. #   It is also possible to remove all the previously configured save  
  18. #   points by adding a save directive with a single empty string argument  
  19. #   like in the following example:  
  20. #  
  21. #   save ""  
  22.   
  23. save 900 1  
  24. save 300 10  
  25. save 60 10000  

save 900 1          #900 秒内如果超过 1 个 key 被修改,则发起快照保存

save 300 10        #300秒超过10个key被修改,发起快照

save 60 10000    #60秒超过10000个key被修改,发起快照

以上三个save的理解:

数据修改的频率非常高,备份的频率也高

数据修改的频率低,备份的频率也低

查看快照持久化文件的名字和存储位置(打开redis.conf):

  1. # The filename where to dump the DB  
  2. dbfilename dump.rdb  
  3.  
  4. # The working directory.  
  5. #  
  6. # The DB will be written inside this directory, with the filename specified  
  7. # above using the 'dbfilename' configuration directive.  
  8. #   
  9. # The Append Only File will also be created inside this directory.  
  10. #   
  11. # Note that you must specify a directory here, not a file name.  
  12. dir ./  

快照持久化 和 精细持久化  可以尽最大程度保证数据的安全:

2、手动发起快照持久化

手动发起快照持久化