Use the #no_loose_disabled-commands parameter to block specific Redis commands that could cause data loss or degrade instance performance.
Some Redis commands carry inherent risks in production environments:
Data deletion commands — FLUSHALL and FLUSHDB clear most or all data in an instance.
Blocking commands — KEYS and HGETALL can block the instance and degrade performance when run against large datasets.
Disabling these commands at the instance level prevents accidental or unauthorized execution.
To ensure stable instance performance, Tair (Redis OSS-compatible) does not allow commands such as CONFIG to be disabled. For more information, see Commands that cannot be disabled.
Disable commands
Log on to the Alibaba Cloud console and go to the Instances page. In the top navigation bar, select the region where your instance resides. Find your instance and click its ID.
In the left-side navigation pane, click Parameter Settings.
On the System Parameters tab, find
#no_loose_disabled-commandsand click Modify in the Actions column.In the dialog box, enter the commands to disable. Use the following format:
Use only lowercase letters
Separate multiple commands with commas (,)
Example:
keys,flushdb
ImportantDisabling a parent command also disables all its subcommands. For example, disabling
scriptblocks SCRIPT EXISTS, SCRIPT LOAD, and all other SCRIPT subcommands. Subcommands cannot be disabled individually.Click OK.
Verify the change
Connect to your instance using redis-cli and run a disabled command. For example, running FLUSHALL returns one of the following errors:
ERR command 'FLUSHALL' not support for normal userNOPERM this user has no permissions to run the 'flushall' commandCommands that cannot be disabled
The following commands are reserved for internal operations and cannot be disabled:
CONFIGMIGRATERESTORE-ASKINGLASTSAVEBGREWRITEAOFREPLICAOFBGSAVEPFDEBUGPFSELFTESTSLAVEOFACL-related commands
MODULE-related commands
DEBUG-related commands
API reference
| API operation | Description |
|---|---|
| DescribeParameters | Queries the configuration and operational parameters of an instance |
| ModifyInstanceConfig | Modifies the parameter settings of an instance |