记录Redis重新记录AOF,重启记录重新告知(redis 重置 aof)

Redis is an open source, data structure server that is popularly used because of its high performance, advanced features, and scalability. It can be used to store key-value data, lists, hashes, sets and other data structures. As an in-memory data store, Redis requires that all data is stored in memory to ensure maximum performance. Redis can also store data on disk for persistence.

In some cases, when Redis is restarted, the data does not persist and is lost, so Redis provides persistency and durability through the redis append-only-file (AOF). The AOF is a log-structured format which continuously updates with every write operation to Redis which is then stored on disk. When Redis is restarted, the contents of the AOF are entered into the new Redis process which re-creates the Redis data store.

Recording AOF happens periodically and can also be triggered manually. There are two ways to trigger an AOF rewrite:

• By running the SAVE command: This command forces an AOF rewrite.

• By changing the auto-AOF-rewrite-percentage setting: This setting controls when a rewrite is automatically triggered. When the size of the AOF increases past the auto-AOF-rewrite-percentage value, an AOF rewrite will be triggered automatically.

The AOF rewrite can be disabled. To do this, the no-appendfsync-on-rewrite configuration setting must be set to “yes”.

Once the configuration settings for AOF recording and rewriting have been set up, Redis can be restarted. On restart, Redis will open the AOF file and execute the log of operations on it, re-creating the Redis data store. The AOF file will be re-recorded on every restart so that the data within it is up-to-date.

In summary, Redis provides durability through the use of the AOF recording and rewriting. Recording the AOF ensures that data is not lost when Redis is restarted, and rewriting the AOF ensures that it is up-to-date. This process happens automatically when Redis is restarted and must be configured correctly in order to work correctly.


数据运维技术 » 记录Redis重新记录AOF,重启记录重新告知(redis 重置 aof)