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 some scenarios, unlimited use of commands may cause some issues. Some Redis commands can delete a large volume of data or all data from a database, such as flushall and flushdb. Improper uses of some commands such as keys and hgetall may cause blocking in the single-threading Redis model and degrade service performance.

To ensure stable and efficient management, you can disable specific commands to minimize risks for your workloads.

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 is deployed. Then, find the instance and click the instance ID.
  2. On the Instance Information page, click System Parameters in the left-side navigation pane.
  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.
    Specify the Redis commands that you want to disable
    Note The commands that you specify can contain only lowercase letters. Separate multiple commands with commas (,). Example: keys,flushall.
  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

Related 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.