Redis bgrewriteaof command

Source: Internet
Author: User

I. background

1. aof:

Redis's aof mechanism is a bit similar to MySQL BINLOG, which is a persistent method provided by redis (the other is RDB). It will write all the commands at a certain frequency (no, always, every seconds) is written to the log file, and the database is restored after redis is stopped and restarted.

 

2. aof rewrite:

(1) As the aof file grows larger, most of the commands are repeated or can be merged (100 incr = set key 100)

(2) benefits of rewriting: reduces aof log size, reduces memory usage, and accelerates database recovery time.

Example:

The basic syntax of the redis bgrewriteaof command is as follows:

# Redis-cli-P 6379-H 127.0.0.1127.0.0.1: 6379> bgrewriteaofredis 127.0.0.1: 6379> background append only file rewriting started

Check that the aof file has become smaller.

 

Redis bgrewriteaof command

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.