[Redis] Redis Data backup recovery and persistence

Source: Internet
Author: User

Database backup, using the Save command, the DUMP.RDB will be generated in the Redis installation directory

For example: in my directory Redis/src/dump.rdb

Use the command config get dir to get the current Redis installation directory

For example:

127.0.0.1:6379> Config get dir

1) "Dir"

2) "/tsh/redis-3.0.0/src"

Use command Bgsave to perform backup operations in the background

For example:

127.0.0.1:6379> Bgsave

Background Saving started

To recover the data, simply put the Dump.rdb file in the Redis installation directory, start the service, and the data will be restored

After my test, did not execute the Save command, when manually closed Redis-server, the Dump.rdb file will be created automatically, and then open the service, the client query data is not lost

Redis The persistence of

Snapshotting (snapshot)

Modify the configuration file, the number of keys modified in the specified time is greater than the set value to execute save, parameter: Number of seconds, the number of keys modified

For example:

Save 20 1

Save 900 1

Save 300 10

Save 60 10000

The configuration file does not work because there are no parameters to the configuration file at the time of the reboot, for example:

Redis-server/tsh/redis-3.0.0/redis.conf

Append only file (aof mode)

Modify configuration file Redis.conf,appendonly Yes

Restart the service, must have the parameters of the configuration file

At this point in the SRC directory generated file appendonly.aof, this file records each step of the operation, the efficiency is slightly slower but more secure

[Redis] Redis Data backup recovery and persistence

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.