Redis BGREWRITEAOF, redisbgrewriteaof

Source: Internet
Author: User

Redis BGREWRITEAOF, redisbgrewriteaof

I was pitted by redis last night. After I got down and restarted, I waited for half an hour to start successfully. By discovering that the aof file was too large, previously, I did not know that this file can be optimized through BGREWRITEAOF.

The reference manual is as follows:

BGREWRITEAOF

Execute an AOF file rewriting operation. Rewriting creates a volume optimized version of the current AOF file.

Even if BGREWRITEAOF fails, no data is lost because the old AOF file is not modified before BGREWRITEAOF is successful.

The rewrite operation is only triggered when no other persistence work is executed in the background, that is:

  • If the Redis sub-process is saving the snapshot, The AOF rewrite operation will be scheduled (scheduled), and the AOF rewrite will be executed after the save operation is complete. In this case, the BGREWRITEAOF returned value is stillOKBut an additional information is added, indicating that BGREWRITEAOF can be executed only after the save operation is complete. In Redis 2.6 or later versions, you can run the INFO command to check whether BGREWRITEAOF is scheduled.
  • If another AOF file is being rewritten, BGREWRITEAOF returns an error, and the new BGREWRITEAOF request will not be scheduled for the next execution.

Starting from Redis 2.4, AOF rewrite is automatically triggered by Redis. BGREWRITEAOF is only used to manually trigger the rewrite operation.


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.