In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Redis provides two different ways of persistence:
RDB: generates snapshots of data within a specified time interval and stores them in binary
AOF: record all write commands executed by the server and restore the dataset by re-executing these commands when the server starts. The new command is appended to the end of the file, and the AOF file is rewritten in the background at regular intervals so that the size of the AOF file does not exceed the actual size needed to save the data.
Redis can also use AOF and RDB at the same time, in this case, when Redis is restarted, it will give priority to using AOF text for data restore, because the data saved by AOF file is usually more complete than that saved by RDB, and AOF and RDB usually work together to make up for their shortcomings to some extent.
Advantages and disadvantages of RDB:
Advantages:
1. The file is compact, which saves the dataset of Redis at a certain point in time, which is very suitable for backup 2. It can maximize the performance of Redis. The only thing the parent process needs to do when saving the RDB file is to fork out a child process, and then the child process will handle all the next persistence work. The parent process does not need to perform any disk IZP O operations.
3. When the amount of data recovery is relatively large, the recovery speed is faster than that of AOF.
Disadvantages:
1. Unable to back up in real time, some data may be lost in case of server failure.
2. Due to the use of child processes for data persistence, it may take up more cpu resources when the data is large.
3. Each time is a full backup, but the incremental backup cannot be realized.
Advantages and disadvantages of AOF:
Advantages:
1. Record the write operation of redis in real time, which will not cause data loss when the server fails.
2. When the AOF file is too large, the AOF is automatically rewritten in the background, and the rewritten AOF file contains the minimum set of commands needed to recover the data.
3. AOF is saved in the format of Redis protocol, which is readable and easy to analyze files.
Disadvantages:
1. The volume of AOF files is usually larger than that of RDB files.
2. The recovery speed of AOF is usually slower than that of RDB
The rewriting process of the AOF file:
When the AOF file volume reaches a certain level, it starts the AOF file rewriting function in the background to open a child process through fork. This process reads the data contents of the entire redis and generates a new AOF file. Two write records are generated in the AOF file rewriting, one is written directly into the old AOF file, and the other is placed in the cache. When the AOF file is rewritten, replace the old AOF file and append the cache write operation to the new AOF file
Replication features:
1. Redis uses asynchronous non-blocking for replication
2. A master can have multiple slaves, and a slave server can also have a slave server
3. You can copy so that the master server does not need persistence, and the slave server performs the persistence operation (this is not recommended)
Replication process:
1. Slave initiates a synchronization request to the master server
2. Master executes bgsave to generate the image file, and the new data generated in this process is stored in the cache. When the bgsave execution is finished, a .rbd file is generated. Master sends the .rbd file and the data from the cache to slave,slave. After receiving the master data, the data is stored in the local hard disk, and the slave loads the data into memory from the local hard disk.
3. Even if multiple slave send synchronization requests to the master server at the same time, the master only needs to execute the bgsave once.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.