You can set the #no_loose_disabled-commands parameter in the ApsaraDB for Redis console to disable specific commands that may degrade service performance and cause data loss.

Background information

In specific scenarios, unlimited use of commands may cause issues. Specific commands clear most of or all the data, such as FLUSHALL and FLUSHDB. Improper use of specific commands may block the ApsaraDB for Redis service and affect instance performance, such as KEYS and HGETALL. You can disable specific commands based on your business needs.

To ensure stable instance performance for ApsaraDB for Redis, specific commands cannot be disabled, such as CONFIG. For more information, see High-risk commands that cannot be disabled.

Procedure

  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 that you want to manage resides. Then, find the instance and click its ID.
  2. In the left-side navigation pane, click System Parameters.
  3. On the System Parameters page, find the #no_loose_disabled-commands parameter and click Modify in the Actions column.
  4. In the dialog box that appears, specify the commands that you want to disable.
    Important The commands that you specify can contain only lowercase letters. Otherwise, an error occurs. Separate multiple commands with commas (,). Example: keys,flushdb.
  5. Click OK.

Results

If you use redis-cli to connect to an instance and run the disabled FLUSHALL command, ApsaraDB for Redis returns the following error: (error) ERR command 'FLUSHALL' not support for normal user. Results

High-risk commands that cannot be disabled

The following commands cannot be disabled: CONFIG, MIGRATE, RESTORE-ASKING, LASTSAVE, BGREWRITEAOF, REPLICAOF, BGSAVE, PFDEBUG, PFSELFTEST, SLAVEOF, ACL-related commands, MODULE-related commands, and DEBUG-related commands.

Related API operations

OperationDescription
DescribeParametersQueries the configuration and operational parameters of an ApsaraDB for Redis instance.
ModifyInstanceConfigModifies parameters of an ApsaraDB for Redis instance.