In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the ways of Redis persistence, the article is very detailed, has a certain reference value, interested friends must read it!
As we all know, redis is an in-memory database, which stores data in memory, which not only speeds up the reading speed, but also brings new problems to data security, that is, when the server where redis is located goes down, all data in the redis database will be lost.
To solve this problem, redis provides persistence. Generally speaking, it is to write the data in memory to the hard disk.
Redis provides several different levels of persistence:
1. RDB persistence can generate a point-in-time snapshot (point-in-time snapshot) of a dataset within a specified time interval.
2. AOF persistence records all write commands executed by the server, and restores the dataset by re-executing these commands when the server starts. All commands in the AOF file are saved in the Redis protocol format, and the new command is appended to the end of the file. Redis can also rewrite (rewrite) the AOF file in the background so that the size of the AOF file does not exceed the actual size required to save the dataset state.
3. Redis can also use both AOF persistence and RDB persistence. In this case, when Redis restarts, it gives priority to using the AOF file to restore the dataset because the dataset saved by the AOF file is usually more complete than the dataset saved by the RDB file.
4. Turn off the persistence function. Let the data only be stored in memory, and the restart will be gone.
RDB persistence of Redis (RDB is enabled by default)
1.Snapshotting:
By default, Redis dump a snapshot of the dataset to the dump.rdb file. In addition, we can also modify the frequency of dump snapshots of the Redis server through the configuration file. After opening the redis.conf file, we search save and see the following configuration information:
Save 9001 # after 900s (15 minutes), if at least one key changes, the dump memory snapshot.
Save 30010 # after 300 seconds (5 minutes), if at least 10 key changes, the dump memory snapshot.
Save 60 10000 # after 60 seconds (1 minute), if at least 10000 key changes, the dump memory snapshot.
2. The mechanism of Dump snapshots:
1)。 Redis forks the child process first.
2)。 The child process writes snapshot data to a temporary RDB file.
3)。 When the child process completes the data write operation, it replaces the old file with a temporary file.
These are all the contents of Redis persistence. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.