Home  >  Article  >  Database  >  When does redis persist?

When does redis persist?

(*-*)浩
(*-*)浩Original
2019-11-02 13:15:102858browse

Persistent storage stores the data stored in memory by Redis on the hard disk to achieve permanent storage of data.

When does redis persist?

We all know that Redis is a memory-based nosql database. Memory storage can easily cause data loss because when the server is shut down, etc. Some abnormal conditions can cause the data stored in the memory to be lost. (Recommended learning: Redis Video Tutorial)

Enable the persistence function of redis and save the data to the disk. When redis is restarted, the data can be restored from the disk.

Redis provides two methods for persistence, one is RDB persistence (the principle is to periodically dump Reids' database records in memory to RDB persistence on disk), and the other is AOF (append only file) persistence (the principle is to write Reids' operation log to the file in an appended manner).

The difference between the two

RDB persistence refers to writing a snapshot of the data set in memory to disk within a specified time interval. The actual operation process is to fork one The child process first writes the data set into a temporary file. After the writing is successful, it replaces the previous file and stores it using binary compression.

When does redis persist?

AOF persistence records every write and delete operation processed by the server in the form of a log. Query operations will not be recorded, but will be recorded in the form of text. You can open the file to view to detailed operation records.

When does redis persist?

The above is the detailed content of When does redis persist?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn