Redis provides an RDB persistence mechanism that writes a snapshot of an in-memory dataset to disk within a specified time interval.
Advantages of the RDB:
1, in this way, backup Redis database only one file, once the system has a catastrophic failure, can be very easy to recover.
2, you can easily transfer a compressed backup file to other secure storage media.
3, maximize performance, start the persistence, just fork out a sub-process, then the child process to complete these persistent work, can greatly avoid the service process to perform IO operations.
4. When the data set is large, the start-up efficiency is high.
Disadvantages of the RDB:
1, can cause the loss of data, because the system once the time to persist before the outage, there is no time to write to the disk data will be lost.
2, the RDB is through the fork process to help complete the database persistence, if the data set is large, it may cause the server to stop the service for hundreds of milliseconds, or even 1 seconds.
The redis.conf configuration items that require changes to the RDB persistence mechanism are as follows:
1. Conditions for triggering an RDB:
2, configuration Whether compression Yes is compressed, no does not compress
3. File name of output Snapshot file:
4. Output Snapshot file directory:
5, Redis security,requirepass set up Redis requires a password, such as redis-cli shutdown I need a password .
6. Configure the maximum number of connections for Redis
7, record the execution time more than 10000 microseconds command
The persistence of Redis--rdb