当前位置:网站首页>Redis persistence
Redis persistence
2022-06-25 01:20:00 【Lutrra】
Persistent configuration
# If 900s Inside , There is at least one shareholder key It's been modified , Let's do persistence
save 900 1
# If in 300s At least 10 individual key It's been modified , It's a persistent operation
save 300 10
# If in 60s At least 10000 individual key It's been modified , Let's do persistence
save 60 10000
# Persistence error continue working
stop-writes-on-bgsave-error yes
# Is it compressed? rdn file
rdbcompression yes
# preservation rdb When you file , Error checking
rdbchecksum yes
dir ./
requirepass # Set the password
maxclients 10000 # Maximum number of clients
maxmemory #
maxmemory-policy noevicition
appendonly no # Not on by default aof
appendfsync everysec # Once a second sync
Persistence operation rdb– a key
Write the data set snapshot in memory to disk within the specified time interval , When it recovers, it reads the snapshot file directly into memory
Redis A separate subprocess will be created for persistence , The data is written to a temporary file , The tape persistence process ends , Replace the last persistent file with this temporary file , The whole process , The main process does not do any IO operation , If large-scale recovery is required , And not very sensitive to the integrity of data recovery , that rdb than aof More efficient
#redis Operate on memory , If you cut off the power, you will lose
#rdb What is kept is dump.rdb file
# Trigger mechanism
#1. Satisfy save Conditions
#2.fulshall command
#3. sign out redis
# recovery rdb file
# Only need to rd Put the file in our redis Boot directory , It checks automatically when it starts up
# advantage : Suitable for large-scale data recovery , The requirement of data integrity is not high
# shortcoming : It takes a certain interval of time , In case of accidental shutdown , Data will be lost ,
Persistence operation aof
Log every write operation , take redis Record all instructions executed , Reading operation does not record , Only files can be added but not rewritten ,redis At the start , The file will be read to rebuild the data ,redis In case of restart, execute the write instruction from the front to the back according to the contents of the log file to complete the data recovery
# What is kept is appendonly.aof
# Not on by default
appendonly yes
# provided that aof There is something wrong with the document. ,redis Can't start , Need repair aof file ,redis-check-aof File for repair
# If aof The document passed the general assembly fork A new process
# advantage : Every change is synchronized , File integrity will be better , Synchronizing once per second may result in data loss , It is most efficient to never synchronize
# shortcoming : Relative to data file ,aof Far greater than rdbm Recovery is also faster than rdb slow ,aof Operating efficiency is also higher than rdb slow , So we redis The default allocation is rdb Persistence
边栏推荐
- “一个优秀程序员可抵五个普通程序员!”
- Abnova丨A4GNT多克隆抗体中英文说明
- 天书夜读笔记——深入虚函数virtual
- Properties of DOM
- 使用 Loki 微服务模式部署生产集群
- Contentresolver, get the SMS content
- 中金财富证券开户佣金多少呢?股票开户交易安全靠谱吗?
- [live review] 2022 Tencent cloud future community city operator recruitment conference and SaaS 2.0 new product launch!
- Yasea APK Download Image
- 修身励学篇
猜你喜欢

Using macro code to generate handwriting automatically in word or WPS

Bi SQL constraints

Bi-sql Union

扎克伯格上手演示四款VR头显原型机,Meta透露元宇宙「家底」

Abnova丨CSV 磁珠中英文说明

Boutique enterprise class powerbi application pipeline deployment

Scala IO read by line

汇编语言(3)16位汇编基础框架与加减循环

How to store dataframe data in pandas into MySQL

Bi skill - judge 0 and null
随机推荐
15.线程同步的几种方法
Abnova丨CSV 磁珠中英文说明
高考之后,必然会出现以下四种情况:
程序员:是花光积蓄在深圳买房?还是回到长沙过“富余”生活?
Merge sort template & understanding
Audio PCM data calculates sound decibel value to realize simple VAD function
VB learning notes
对技术的乐观,正让戴尔取得比想象中更多的成就
Bi-sql top
ImageView展示网络图片
木瓜蛋白酶中英文说明书
汇编语言(3)16位汇编基础框架与加减循环
"One good programmer is worth five ordinary programmers!"
Picture rotation move zoom gradient
Bi-sql - different join
Go language operators (under Lesson 8)
Welcome to the new world of Lenovo smart screen
VB 学习笔记
1. package your own scaffold 2 Create code module
图片旋转移动缩放渐变