当前位置:网站首页>Redis持久化的使用拓展
Redis持久化的使用拓展
2022-07-22 01:50:00 【只是六号z】
Redis持久化的使用拓展
1、RDB持久化方式能够在指定的时间间隔内对你的数据进行快照存储
2、AOF持久化方式记录每次对服务器写的操作,当服务器重启的时候会重新执行这些命令来恢复原始的数据,AOF命令以Redis 协议追加保存每次写的操作到文件末尾,Redis还能对AOF文件进行后台重写,使得AOF文件的体积不至于过大。
3、只做缓存,如果你只希望你的数据在服务器运行的时候存在,你也可以不使用任何持久化
4、同时开启两种持久化方式
在这种情况下,当redis重启的时候会优先载入AOF文件来恢复原始的数捆,因为在通常情况下AOF文件保存的数据集要比RDB文件保存的数据集要完整。
RDB的数据不实时,同时使用两者时服务器重启也只会找AOF文件,那要不要只使用AOF呢?作者建议不要,因为RDB更适合用于备份数据库(AOF在不断变化不好备份),快速重启,而且不会有AOF可能潜在的Bug,留着作为一个万一的手段。
5、性能建议
因为RDB文件只用作后备用途,建议只在Slave上持久化RDB文件,而且只要15分钟备份一次就够了,只保留save 9001这条
·如果Enable AOF,好处是在最恶劣情况下也只会丢失不超过两秒数据,启动脚本较简单只load自己的AOF文件就可以了,代价一是带来了持续的IO,二是AOF rewrite的最后将rewrite过程中产生的新数据写到新文件造成的阻塞几乎是不可避免的。只要硬盘许可,应该尽量减少AOFrewrite的频率,AOF重写的基础大小默认值64M太小了,可以设到5G以上,默认超过原大小100%大小重写可以改到适当的数值。
如果不Enable AOF,仅靠Master-Slave Repllcation 实现高可用性也可以,能省掉一大笔IO,也减少了rewrite时带来的系统波动。代价是如果Master/Slave同时倒掉,会丢失十几分钟的数据,启动脚本也要比较两个Master/Slave 中的RDB文件,载入较新的那个,微博就是这种架构。
边栏推荐
- Analysis sample of a video app
- [AR Foundation] AR Session Origin
- Simple use of Android kotlin
- [MySQL series] addition, deletion, modification and query of MySQL tables (Advanced)
- How to solve the "last mile of delivery" of community group purchase
- 分布式链路追踪-skywalking基础
- JVM (I) -- Introduction to JVM
- 2022-07-13 comparison of fast subquery and slow subquery execution of mysql/stonedb
- 2022-07-18 Jenkins pipeline use and create your own pipeline
- 2022-07-13 mysql/stonedb子查询-优化器处理记录
猜你喜欢
ADS多频功放偏置网络设计
JVM (I) -- Introduction to JVM
[open source diary] dormitory power-off automatic light off equipment (II)
2022-07-13 comparison of fast subquery and slow subquery execution of mysql/stonedb
再见Attention:建模用户长期兴趣的新范式
2022-07-15 mysql接收新连接处理
[attack and defense world web] difficulty 2-star 6-point introductory question (Part 1): webshell, command_ execution、xff_ referer、php_ rce、Web_ php_ include、NewsCenter
Do you know who the "open source queen" is-- Facing the threat of being fired, she still insisted on opening a famous project
【社媒营销】进来了解下Whatsapp Business API?出海群发不用愁!
JVM (一) --------- JVM 简介
随机推荐
[MySQL series] "once and for all" solves the problem of "inserting Chinese data" in MySQL
硅片厚度测量
2022-07-15 MySQL receives new connection processing
How to make the signal of conductive slip ring better
Tencent cloud deploys Devops
MySQL的锁机制:MyISAM 表锁、InnoDB行锁
Worthington peptide synthesis application chymotrypsin scheme
PMP考试敏捷比重猛增,如何备考?
2022-07-18 Jenkins pipeline use and create your own pipeline
JVM (一) --------- JVM 简介
[attack and defense world web] difficulty 2-star 6-point introductory question (Part 1): webshell, command_ execution、xff_ referer、php_ rce、Web_ php_ include、NewsCenter
2022-07-15 mysql/stonedb子查询性能分析-FindOneInsidePack
Pytorch Deep Learning Practice - 1 - Overview
2022-07-15 mysql接收新连接处理
怎样可以让导电滑环的信号更好
2022-07-18 Jenkins deployment
2022-07-15 mysql/stone sub query memory copy analysis and optimization
测试下投票的功能
Time of regular release under test
2022-07-18 jenkins流水线使用及创建自己的流水线