This topic describes the limits on the commands supported by cluster instances. Cluster instances and standard instances are deployed in different architectures of ApsaraDB for Redis. These types of instances follow different rules to run Redis commands.

Limited commands

Key String List HyperLogLog Transaction Scripting
RENAME MSETNX RPOPLPUSH PFMERGE DISCARD EVAL
RENAMENX None BRPOP PFCOUNT EXEC EVALSHA
SORT None BLPOP None MULTI SCRIPT EXISTS
None None BRPOPLPUSH None UNWATCH SCRIPT FLUSH
None None None None WATCH SCRIPT KILL
None None None None None SCRIPT LOAD

Unsupported commands

SWAP

Limits

  • To run limited commands in cluster instances, you can use hash tags to make sure that target keys are distributed in a hash slot. For more information, see Limited commands.

    For example, if you process key1, aakey, and abkey3, you must store them as {key}1, aa{key}, and ab{key}3 to run the limited commands. For more information, visit Official Redis Documentation.

  • 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 as you run them in a 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 do not support 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.
  • When you run Lua scripts on a cluster instance, follow these limits:
    • You must use KEYS arrays to pass all keys. For Redis commands in redis.call() and redis.pcall(), keys must be KEYS arrays. You cannot replace KEYS with Lua variables. Otherwise, the system returns the following error: "-ERR bad lua script for redis cluster, all the keys that the script uses should be passed using the KEYS array\r\n".
    • All keys must be in the same slot. Otherwise, the system returns an error: "-ERR eval/evalsha command keys must be in same slot\r\n".
    • You must use keys when you run Redis commands. Otherwise, the system returns an error: "-ERR for redis cluster, eval/evalsha number of keys can't be negative or zero\r\n".
    • Pub/Sub commands are not supported, including PSUBSCRIBE, PUBSUB, PUBLISH, PUNSUBSCRIBE, SUBSCRIBE, and UNSUBSCRIBE.
    Note You can ignore these limits when you run Lua scripts on a standard ApsaraDB for Redis instance.