This topic describes the limits on the commands supported by cluster instances. Cluster instances and standard instances have different architectures and follow different rules to run Redis commands.

Supported commands

Commands that are not supported

  • SWAPDB
  • CLIENT ID
  • SORT, which is used together with the BY and GET options

Commands with limits

Note To run the following commands with limits on cluster instances, use hash tags to make sure that all keys are distributed in one hash slot. For more information, see Redis documentation.
Command group Command
HyperLogLog PFMERGE and PFCOUNT
Keys RENAME, RENAMENX, and SORT
Lists RPOPLPUSH, BRPOP, BLPOP, and BRPOPLPUSH
Scripting EVAL, EVALSHA, SCRIPT EXISTS, SCRIPT FLUSH, SCRIPT KILL, and SCRIPT LOAD
Strings MSETNX
Transaction DISCARD, EXEC, MULTI, UNWATCH, and WATCH

Limits on Lua scripts

You can use Lua scripts to process check-and-set (CAS) commands to improve the performance of ApsaraDB for Redis. You can combine multiple CAS commands in a Lua script and execute the script to implement CAS with higher efficiency. To make sure that all operations in a Lua script are performed in the same hash slot, the cluster instance of ApsaraDB for Redis imposes the following limits on a Lua script:

Note If an EVAL command fails to run (for example, the "ERR command eval not support for normal user" message is returned), upgrade the minor version of the ApsaraDB for Redis instance to the latest version. For more information, see Upgrade the minor version.
  • The Lua script uses the redis.call/redis.pcall function to run Redis commands. For Redis commands, all the keys must be passed by using the KEYS array, which cannot be replaced by Lua variables. Otherwise, the following error message is returned:
    -ERR bad lua script for redis cluster, all the keys that the script uses should be passed using the KEYS array\r\n
  • All the keys that the script uses must be allocated to the same hash slot. Otherwise, the following error message is returned:
    -ERR eval/evalsha command keys must be in same slot\r\n
  • Keys must be included in all the commands that you want to run. Otherwise, the following error message is returned:
    -ERR for redis cluster, eval/evalsha number of keys can't be negative or zero\r\n
  • The following Pub/Sub commands are not supported: PSUBSCRIBE, PUBSUB, PUBLISH, PUNSUBSCRIBE, SUBSCRIBE, and UNSUBSCRIBE.
  • The UNPACK function is not supported.

Other limits

  • You can run the CLIENT LIST command to retrieve information about the connections to the specified proxy server. The following list describes the response:
    • The following fields have the same meaning as the fields in open source Redis: id, age, idle, addr, fd, name, db, multi, omem, and cmd.
    • The values of the sub and psub fields are both 1 or both 0.
    • The qbuf, qbuf-free, obl, and oll fields are reserved. You can ignore these fields.
  • You can run the CLIENT KILL command in the client kill ip:port or client kill addr ip:port format.
  • If you do not run the WATCH command before a transaction is executed, and each command in the transaction processes only one key, the keys processed by all commands can be distributed in different slots. You can run these commands in the same way you run the commands in a Redis database that is connected without a proxy server. In other scenarios, all keys that all commands process in a transaction must be in the same slot.
    • The commands that process multiple keys include DEL, SORT, MGET, MSET, BITOP, EXISTS, MSETNX, RENAME, RENAMENX, BLPOP, BRPOP, RPOPLPUSH, BRPOPLPUSH, SMOVE, SUNION, SINTER, SDIFF, SUNIONSTORE, SINTERSTORE, SDIFFSTORE, ZUNIONSTORE, ZINTERSTORE, PFMERGE, and PFCOUNT.
    • The commands that are not supported in transactions include WATCH, UNWATCH, RANDOMKEY, KEYS, SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB, SCRIPT, EVAL, EVALSHA, SCAN, ISCAN, DBSIZE, ADMINAUTH, AUTH, PING, ECHO, FLUSHDB, FLUSHALL, MONITOR, IMONITOR, RIMONITOR, INFO, IINFO, RIINFO, CONFIG, SLOWLOG, TIME, and CLIENT.