当前位置:网站首页>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
边栏推荐
猜你喜欢

4年工作经验,多线程间的5种通信方式都说不出来,你敢信?

Bi SQL alias

Tianshu night reading notes -- memory paging mechanism

Zuckerberg demonstrated four VR head display prototypes, and meta revealed the "family" of metauniverse

数组中关于sizeof()和strlen

Première application de l'informatique quantique à la modélisation des flux de puissance dans les systèmes énergétiques à l'Université technique danoise

Deploy a production cluster using Loki microservice pattern

丹麦技术大学首创将量子计算应用于能源系统潮流建模

Introduction to bi-sql wildcards

Bi-sql - join
随机推荐
丹麥技術大學首創將量子計算應用於能源系統潮流建模
How much commission does CICC wealth securities open an account? Is stock account opening and trading safe and reliable?
Assembly language (4) function transfer parameters
Start service 11111
Bi-sql index
【实用系列】家内wifi全覆盖
bindservice方法实现音乐播放暂停
ImageView shows network pictures
腾讯搬家了!
Zuckerberg demonstrated four VR head display prototypes, and meta revealed the "family" of metauniverse
VB learning notes
Introduction to bi-sql wildcards
Bi-sql top
Install mysql5.6 under linux64bit - the root password cannot be modified
用手机在同花顺上开户靠谱吗?这样炒股有没有什么安全隐患
重磅:国产IDE发布,由阿里研发,完全开源!(高性能+高定制性)
Distinguish between i++ and ++i seconds
C language boundary calculation and asymmetric boundary
lnmp环境安装ffmpeg,并在Yii2中使用
2种常见的设备稼动率OEE监测方法