DCS Redis Help Documentation

Redis Commands

2024-05-25 04:01:05

What Are the Possible Reasons for Failing to Execute Redis Commands?

Connection failure: It is unable to connect to the Redis server or is disconnected from the server. The failure may be caused by a network problem, a server fault, or incorrect firewall configurations.

Nonexistent keys: You cannot run a command on a nonexistent key. Before running a command, ensure that the key exists in Redis or check necessary items.

Incorrect data type: Redis commands are used for certain data types. If a Redis command is executed on an incorrect data type, the execution will fail. For example, try to execute a list command on a string key.

Syntax errors: The command has incorrect syntax or parameters. Ensure that commands and parameters are correct, and check for syntax errors.

Memory limit: The Redis server is running out of memory. In this case, you can release some memory or increase the memory of the server.

Concurrent operations: In scenarios with a large number of concurrent operations, conflicts and failures may occur if multiple clients change the same key simultaneously. You can use a concurrency control mechanism, such as transactions or optimistic locking.

Can I Configure Redis Keys to Be Case-Insensitive?

No. Like in open-source Redis, keys in DCS Redis are case-sensitive and cannot be configured to be case-insensitive.

Does DCS Redis Support Pipelining?

Pipelining is supported by stand-alone and active/standby instances but is not supported by clusters.

Does DCS Redis Support the INCR and EXPIRE Commands?

Yes. For more information about Redis command compatibility, see Redis Command Compatibility.

Can I View the Most Frequently Used Redis Commands?

No. Redis does not record commands and does not support viewing the most frequently used commands.

How Do I Clear Redis Data?

On the console, you can clear Redis data. For more information, see Deleting Instance Data.

Is There a Time Limit on Executing Redis Commands?

Redis command timeout can be controlled on the client by configuring some parameters. The parameters vary for different client libraries. For details, see relevant documents of clients.

On the server end, the timeout parameter is set to 0 by default, indicating that connections will not be terminated.

If a command times out, a timeout exception or connection interruption may occur. You can handle command timeout based on your requirements and site conditions. Generally, you can take proper measures to handle a detected exception, such as retrying the command, logging or returning appropriate error information to the user. You can also reduce command timeouts by adjusting the timeout duration, optimizing commands, or adding more server resources.

How Do I Find Specified Keys and Traverse All Keys?

You can run the SCAN command to find keys and traverse all keys with specified conditions. SCAN is an iterative cursor command that returns matched keys in batches instead of returning all keys at a time. For more information on how to use the SCAN command, see Redis Official Website.

Common Web CLI Errors

Connection refused: This error indicates that the instance cannot connect to the Redis server. Possible causes: The Redis server is not started, or the specified host or port is incorrect.

Could not resolve hostname: The specified Redis host name cannot be resolved to a valid IP address. Possible causes: The host name is misspelled, DNS configurations are incorrect, or the network is unreachable.

ERR Wrong number of arguments for 'xxx' command: This error indicates that the executed Redis command has a parameter error or syntax error. Rewrite the command by referring to the open-source Redis command protocol.

ERR unknown command 'xxx': This error indicates that the command is not a valid command defined by Redis. Rewrite the command by referring to the open-source Redis command protocol.

ERR Unsupported command: 'xxx': This error indicates that the command is disabled for DCS Redis instances.

Why is "permission denied" Returned When I Run the Keys Command in Web CLI?

The Keys command is disabled in Web CLI. This command can only be run in redis-cli.


uhE54a4Rjiwh