Home  >  Article  >  Database  >  How redis stores data

How redis stores data

silencement
silencementOriginal
2019-06-06 16:00:2310885browse

How redis stores data

#What is redis?

Redis is a high-performance key-value database. The emergence of redis has largely compensated for the shortcomings of key/value storage such as memcached, and can play a very good supplementary role to relational databases in some situations. It provides Java, C/C, C#, PHP, JavaScript, Perl, Object-C, Python, Ruby, Erlang and other clients, which is very convenient to use. (redis tutorial)

How does redis store data?

Redis saves data in memory, but it also writes data to the hard disk regularly.

Redis has two ways to save data:

1. Snapshot mode (Snapshot)

It supports two snapshot modes:

1. Scheduled snapshot, that is, saving the data in the memory to the disk at a certain time.

2. Quantitative snapshot, that is, saving the data to the disk after the data changes a certain number of times.

2. Write mode (Append Only File)

In this mode, Redis will save all commands that modify data (such as Update, Set), etc. into an ASAP file that can only be appended. , when Redis restarts, it will re-execute the commands in this file.

Where is the data saved?

The data is saved in a data file. The specific file name depends on the Redis configuration file, that is, Redis.conf

config get dbfilename (return dump.rdb)

You can use config set dbfilename new (modify the file you want to save the data in)





The above is the detailed content of How redis stores data. 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