Home  >  Article  >  Database  >  What is redis persistence

What is redis persistence

青灯夜游
青灯夜游Original
2019-06-06 14:06:415957browse

Redis is an advanced key-value database. It is similar to memcached, but data can be persisted and supports a wide range of data types. There are strings, linked lists, sets and sorted sets. It supports calculating the union, intersection and complement (difference) of sets on the server side, and also supports a variety of sorting functions. So Redis can also be regarded as a data structure server.

What is redis persistence

#What is redis persistence?

All data in Redis is stored in memory. If redis crashes, it will be lost. Redis persistence is to save data to disk (a storage device that can be permanently saved) for data recovery. (Recommended learning: Redis video tutorial)

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

RDB persistence refers to writing the snapshot of the data set in the memory to the disk within a specified time interval. The actual operation process is to fork a child process and first write the data set to a temporary file. After the writing is successful, , then replace the previous file and store it with binary compression.

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

Persistence implementation method

● Snapshot method

A complete backup of data at a certain point in time. For example, Redis RDB and MySQL Dump are all in this way.

● Log writing method

Any data updates are recorded in the log. When data recovery is required at some point, the complete log process must be repeated. For example, MySQL's Binlog, HBase's HLog and Redis' AOF are this way.

For more redis related technical knowledge, please visit the Redis usage tutorial column to learn!

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