首页 > 数据库 >Redis - Persistence

Redis - Persistence

时间:2022-08-18 18:34:28浏览次数:51  
标签:AOF fsync Redis Persistence RDB data persistence

• RDB (Redis Database): The RDB persistence performs point-in-time snapshots of your dataset at specified intervals.
• AOF (Append Only File): The AOF persistence logs every write operation received by the server.
• No persistence: If you wish, you can disable persistence completely.
• RDB + AOF: It is possible to combine both AOF and RDB in the same instance.

RDB advantages

• RDB is a very compact single-file point-in-time representation of your Redis data.
• RDB is very good for disaster recovery.
• RDB maximizes Redis performances since the only work the Redis parent process needs to do in order to persist is forking a child that will do all the rest. The parent process will never perform disk I/O or alike.
• RDB allows faster restarts with big datasets compared to AOF.

RDB disadvantages

• RDB is NOT good if you need to minimize the chance of data loss in case Redis stops working.
• RDB needs to fork() often in order to persist on disk using a child process.

AOF advantages

• Using AOF Redis is much more durable: you can have different fsync policies: no fsync at all, fsync every second, fsync at every query.
• The AOF log is an append-only log, so there are no seeks, nor corruption problems if there is a power outage.
• Redis is able to automatically rewrite the AOF in background when it gets too big. T
• AOF contains a log of all the operations one after the other in an easy to understand and parse format.

AOF disadvantages

• AOF files are usually bigger than the equivalent RDB files for the same dataset.
• AOF can be slower than RDB depending on the exact fsync policy.

Ok, so what should I use?

The general indication you should use both persistence methods is if you want a degree of data safety comparable to what PostgreSQL can provide you.
If you care a lot about your data, but still can live with a few minutes of data loss in case of disasters, you can simply use RDB alone.
There are many users using AOF alone, but we discourage it since to have an RDB snapshot from time to time is a great idea for doing database backups, for faster restarts, and in the event of bugs in the AOF engine.

标签:AOF,fsync,Redis,Persistence,RDB,data,persistence
From: https://www.cnblogs.com/feiqiangsheng/p/16599728.html

相关文章

  • Redis不同版本集群搭建
    redis集群搭建官方网址:https://redis.io/download/下载下来的为.tar.gz扩展名的源码包。一、redis5.0版本之前集群搭建需要redis-trib.rb工具来完成集群的创建,redis-tr......
  • Redis 数据类型list以及使用场景
    简介: Redis数据类型list以及使用场景数据存储需求:存储多个数据,并对数据进入存储空间的顺序进行区分需要的存储结构:一个存储空间保存多个数据,且通过数据可以体现进入顺......
  • redis安全篇
    redis安全redis被攻击,作为突破口,服务器惨遭毒手的事太常见了。大多数云服务器被攻击,都是redis,mongodb等数据库被入侵。因此修改端口,密码,以及注意bind运行地址,是必须。......
  • Redis篇:Linux下操作redis
    目录一、redis介绍安装和配置典型应用场景1.1介绍1.2redis特性1.3下载安装1.4三种启动方式1.5客户端链接1.6redis典型使用场景二、API的使用2.1通用命令2.2字符串......
  • linux 在线安装redis6.2.4
    1.下载安装包(usr/local)wgethttp://download.redis.io/releases/redis-6.2.4.tar.gz1.1如果wget报错安装weget插件yum-yinstallwget 2.解压安装包tar......
  • 评分管理系统环境部署:JDK1.8,nginx:1.14.0,redis 6.2.4 ,mysql 8.0.22
    背景:环境要求服务器上部署项目,需要JDK1.8,nginx:1.14.0,redis6.2.4,mysql8.0.22,使用在线安装版本或者docker版本;linux的版本是CentOs7.4(cat/etc/redhat-release);jdk......
  • Redis5种基本数据类型的常用操作命令
    1、key相关操作1kyes*--查看所有key2existskey--判断key是否存在3typekey--查看key类型4delkey--删除key5unlinkkey--删除key【异步】6expirekey......
  • Redis主从复制
    文章中的环境都是部署在云服务器上的,感兴趣的小伙伴可以选择3A云服务进行学习一、主从复制简介1.你的“Redis”是否高可用单机redis的风险与问题问题1.机器故障现象:......
  • 20. Redis---发布订阅
    1.前言RedisPubSub模块又称发布订阅者模式,是一种消息传递系统,实现了消息多播功能。发布者(即发送方)发送消息,订阅者(即接收方)接收消息,而用来传递消息的链路则被称为 chan......
  • Redis---服务端命令
    1.前言Redis服务器是对客户端提供服务的主体,只要是安装了Redis数据库的计算机都可以通过本地,或者远程的方式对外提供服务。Redis服务器能够以高可用集群的方式对外提......