By default, append-only file (AOF) persistence is enabled for ApsaraDB for Redis. This topic describes how to set the appendonly parameter to enable or disable AOF persistence.

Overview

ApsaraDB for Redis provides two data persistence options: AOF persistence and Redis Database (RDB) persistence. AOF persistence logs every write operation received by the server, such as SET. When you restart an ApsaraDB for Redis instance, the service reruns the commands in the AOF files to restore data. If AOF files are larger than required, open source Redis runs an AOF rewrite task to recreate AOF files and minimize the size of AOF files.

You can specify the AOF_FSYNC_EVERYSEC policy to enable AOF persistence in ApsaraDB for Redis. After you specify this policy, the system records all write commands in an AOF file every second and saves the AOF file to disks. The policy has a negligible impact on the performance and can minimize data loss caused by accidental operations. ApsaraDB for Redis allows you to archive incremental backups based on AOF files and ensures service performance when the system runs the AOF rewrite task.

AOF persistence may affect write performance. If an ApsaraDB for Redis instance is used in a cache-only scenario, you can perform the operations described in this topic to set the appendonly parameter to disable AOF persistence for the instance.

Status and impacts of AOF persistence

  • By default, AOF is enabled for an ApsaraDB for Redis instance.
  • If you set the appendonly parameter to no, the following impacts exist:
    • The system disables AOF persistence without the need to restart the instance.
    • After AOF persistence is disabled, AOF files cannot be used to restore data.
    • The existing AOF logs remain unaffected.
    • For a standard instance, AOF persistence is disabled for the master node and the replica node is not affected.
    • For a cluster instance, AOF persistence is disabled for the master nodes of all data shards and the replica nodes are not affected.
    • For a read/write splitting instance, AOF persistence is disabled for the master node and all read replicas and the replica node is not affected.
  • If you change the appendonly value to yes, the system enables AOF persistence without the need to restart the instance.

Disable AOF persistence in the ApsaraDB for Redis console

  1. Log on to the ApsaraDB for Redis console and go to the Instances page. In the top navigation bar, select the region in which the instance is deployed. Then, find the instance and click the instance ID.
  2. In the left-side navigation pane, click System Parameters.
  3. On the System Parameters page, click Modify in the Actions column corresponding to the appendonly parameter.
  4. In the dialog box that appears, perform the following steps:
    Warning After you disable AOF persistence, you can no longer use AOF files to restore data. You can only use RDB files to restore data. Proceed with caution. For more information about RDB files, see Backup and restoration solutions.
    1. Set the appendonly parameter.
      Valid values:
      • yes: enables AOF persistence.
      • no: disables AOF persistence.
    2. Click OK.

Related API operations

Operation Description
DescribeParameters Queries the configuration and operational parameters of an ApsaraDB for Redis instance.
ModifyInstanceConfig Modifies parameters of an ApsaraDB for Redis instance.