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.
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. After you restart ApsaraDB for Redis, the service runs the operations logged in the AOF files to restore data. If the files become too big, ApsaraDB for Redis can rewrite the files to optimize storage usage in the background.
AOF persistence follows the AOF_FSYNC_EVERYSEC policy of fsync every second write performances. The system records the received write commands to AOF every second. The policy has the least effect on the performance and can minimize data loss caused by user errors or a power outage. ApsaraDB for Redis can archive incremental AOF files to ensure service performance when ApsaraDB for Redis rewrites the logs.
AOF persistence may affect the write performance. If an ApsaraDB for Redis instance is used in a cache-only scenario, you can perform the operations 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 value of appendonly to no:
- The system disables AOF persistence without restarting the instance.
- After AOF persistence is disabled, the AOF files cannot be used to restore the data.
- The existing AOF logs remain unchanged.
- For a standard instance, AOF persistence is disabled for the master. The replica is not affected.
- For a cluster instance, AOF persistence is disabled for the master nodes of all data shards. The replica nodes are not affected.
- For a read/write splitting instance, AOF persistence is disabled for the master node and all read replicas. The replica node is not affected.
- If you change the value of appendonly to yes: The system enables AOF persistence without restarting the instance.
Disable AOF persistence in the console
- Log on to the ApsaraDB for Redis console.
- On the top of the page, select the region where the instance is deployed.
- On the Instances page, click the Instance ID of the instance.
- On the Instance Information page, click System Parameters in the left-side navigation pane.
- On the System Parameters page, click Modify in the Actions column for the appendonly parameter.
- In the dialog box that appears, perform the following operations: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.
- Set the appendonly parameter.Valid values:
- yes: enables AOF persistence.
- no: disables AOF persistence.
- Click OK.
- Set the appendonly parameter.
|DescribeParameters||Queries the configuration and operational parameters of an ApsaraDB for Redis instance.|
|ModifyInstanceConfig||Modifies parameters of an ApsaraDB for Redis instance.|