Redis Database recovery database or database migration via Dump.rdb file

Source: Internet
Author: User

Environment: centos7.2
Software: redis-3.2.10 (yum installation)

Scenario One: Before the company's Redis does not open aof mode, has been an RDB mode, but the data is very important, the data can not be lost, so need to open aof, but Redis default is to load data from appendonly.aof, Systemctl start Redis, the database is empty because we don't have a appendonly.aof file, and when you close Redis, the Dump.rdb is emptied

Scenario Two: Redis database migration, we can only use Dump.rdb files, because the Dump.rdb file is relatively small, easy to carry

The first step: in the/etc/redis.conf configuration file, we only open the RDB mode and start Redis so that the data files are loaded in

Step two: Use the REDIS-CLI command, log in to Redis, execute the bgrewriteaof command, regenerate the aof file

Step three: Turn off Redis and turn on aof mode in/etc/redis.conf

Fourth step: Re-open the Redis service, this time, Redis will read the appendonly.aof file, load the full database

Redis Database recovery database or database migration via Dump.rdb file

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.