Home >Database >Redis >There are several ways to persist redis

There are several ways to persist redis

WBOY
WBOYforward
2023-05-27 15:28:061229browse

How many ways are there to persist redis?

Answer: There are two main ways:

1) Snapshot persistence

has been automatically enabled in the redis configuration file,

The format is: save N M

means that if redis is modified at least M times within N seconds, redis will take a snapshot to the disk.

Of course we can also manually execute the save or bgsave (asynchronous) command to make a snapshot

2) append only file AOF persistence

There are three modes in total, such as

appendfsync The default of everysec is to force writing to disk once per second

appendfsync always Force writing to disk every time a write operation is performed

appendfsync no completely depends on OS and performance The best but persistence cannot be guaranteed

The third mode is the best. Redis also adopts the third mode by default.

The above is the detailed content of There are several ways to persist redis. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete