In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
What is the difference between the two ways in which redis implements persistence? In response to this problem, the editor summed up this article today, hoping to help more friends who want to solve this problem to find a more simple and feasible way.
Redis is an advanced key-value database. It is similar to memcached, except that data can be persisted and supports a wide range of data types.
There are strings, linked lists, sets and ordered collections. Support in the server-side calculation of the collection union, intersection and complement set (difference), etc., but also supports a variety of sorting functions. So Redis can also be seen as a data structure server.
All data in Redis is stored in memory and then saved to disk asynchronously from time to time (this is called "semi-persistent mode"); each data change can also be written to an append only file (aof) (this is called "full persistence mode").
Since the data of Redis is stored in memory, if persistence is not configured, all data will be lost after redis restart, so you need to enable the persistence feature of redis to save the data to disk. When redis restarts, you can recover the data from disk.
Redis provides two ways for persistence, one is RDB persistence (the principle is to dump the database records of Reids in memory regularly to RDB persistence on disk), and the other is AOF (append only file) persistence (the principle is to write the operation log of Reids to a file in an appended way).
So what's the difference between these two persistence methods, and how to choose them? Most of what I read on the Internet are about how to configure and how to use the two methods, but they do not introduce the difference between them and what application scenarios they are used in.
The difference between the two
RDB persistence means that the snapshot of the dataset in memory is written to disk within a specified time interval. The actual operation is a child process of fork, which first writes the dataset to a temporary file, and then replaces the previous file and stores it with binary compression.
Trigger condition
There are two kinds of triggers for RDB persistence: manual trigger and automatic trigger.
AOF persistence records every write, delete and other change operations handled by the server in the form of a log. Query operations are not recorded, but are recorded in the form of text. You can open a file to see detailed operation records. (append)
This is the difference between the two ways to achieve persistence in redis. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.