Redis persistence-RDB and Redis persistence-RDB
Redis provides a RDB persistence mechanism, that is, to write data set snapshots in the memory to the disk at a specified interval.
Advantages of RDB:
1. In this way, there is only one file to back up the Redis database. Once the system encounters a catastrophic fault, it can be easily restored.
2. You can easily transfer a compressed backup file to other secure storage media.
3. Maximize the performance. When starting persistence, you only need to fork a sub-process, and then the sub-process completes the persistence work, which can greatly prevent the service process from performing IO operations.
4. the startup efficiency is high when the dataset is large.
Disadvantages of RDB:
1. Data may be lost because once the system goes down before scheduled persistence, data that has not been written to the disk will be lost.
2. RDB uses the fork sub-process to help complete database persistence. If the dataset is large, the server may stop serving for several hundred milliseconds or even one second.
The redis. conf configuration items to be modified for the RDB persistence mechanism are as follows:
1. Conditions for triggering RDB:
2. Whether to compress the configuration. yes, yes, no, no.
3. Name of the output snapshot file:
4. Directory of the output snapshot file:
5. For Redis security, requirepass requires a password to set redis. For example, redis-cli shutdown requires a password.
6. Configure the maximum number of connections of Redis
7. Record commands that have been executed for over 10000 microseconds