In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
What is the difference between redis and memcache?
To put it simply, if there is no persistent redis, it is the same as memcache, which is equivalent to a cache database.
How does redis solve data persistence?
Redis has two persistence schemes: RDB (Redis DataBases) and AOF (AppendOnly File)
RDB persistence (detailed analysis: https://blog.51cto.com/13690439/2118462)
RDB is snapshot snapshot storage and is the default persistence method.
RDB will periodically save the data to disk according to a certain strategy. (the next cycle will be a failure on arrival, and data will be lost)
With the help of the copy on write mechanism of the fork command, the current process is fork out of a child process when the snapshot is generated.
Then cycle through all the data in the child process and write the data into a RDB file.
AOF persistence (detailed analysis: https://blog.51cto.com/13690439/2118465)
AOF has better persistence than the RDB approach.
Redis appends every write command received to the end of the file through the write function, similar to msyql's binlog.
When redis restarts, the contents of the entire database are rebuilt in memory by re-executing the write command saved in the file.
To put it simply:
RDB: persists data periodically according to policy
AOF: is to record modification operations constantly
The choice of persistence mode:
Both RDB and AOF operations are sequential IO operations with high performance.
At the same time, when the database is recovered through RDB files or AOF logs, the data is also sequentially read and loaded into memory.
So it will not cause random reading of the disk.
In general, if you want to provide high data security, it is recommended that you use both persistence methods.
If you can accept a few minutes of data loss caused by a disaster, then you can only use RDB.
In terms of data recovery:
The startup time of RDB will be shorter for two reasons:
1. There is only one record for each piece of data in the RDB file, unlike the AOF log, which may have multiple operations of a piece of data.
So each piece of data only needs to be written once.
2. The storage format of RDB file is the same as that of Redis data in memory, so there is no need for data coding.
Therefore, the CPU consumption is much less than the load of the AOF log.
Common market architecture:
At present, the usual design idea is to use Replication mechanism to make up for the lack of performance of aof and snapshot, so as to achieve data persistence.
That is, neither Snapshot nor AOF is done on Master to ensure the read and write performance of Master.
On the Slave, both Snapshot and AOF are enabled for persistence to ensure the security of the data.
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: 208
*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.