Home >Database >Redis >What is snapshot persistence

What is snapshot persistence

藏色散人
藏色散人Original
2020-07-01 09:49:353068browse

Snapshot persistence refers to writing all data at a certain moment to the hard disk. Snapshots are binary serialized forms of memory data and are very compact in storage, while AOF logs record instructions for modifying memory data. Record text.

What is snapshot persistence

Snapshot persistence

Write all data at a certain moment to the hard disk. Using the BGSAVE command, as memory usage increases, executing BGSAVE may cause the system to pause for a long time.

Related introduction:

All the data of Redis is in the memory. If there is a sudden downtime, all the data will be lost. Therefore, there must be a mechanism to ensure that the data of Redis will not be lost due to failure. , this mechanism is the persistence mechanism of Redis.

Redis has two persistence mechanisms, the first is snapshot, and the second is AOF log. A snapshot is a full backup, and an AOF log is a continuous incremental backup. Snapshot is a binary serialized form of memory data, which is very compact in storage, while AOF log records the instruction record text of memory data modification. The AOF log will become extremely large during long-term operation. When the database is restarted, the AOF log needs to be loaded for command replay, which will take an extremely long time. Therefore, AOF needs to be rewritten regularly to slim down the AOF log.

Related learning recommendations: redis tutorial


The above is the detailed content of What is snapshot persistence. 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