Supported Redis commands

Last Updated: Jan 17, 2018

ApsaraDB for Redis is compatible with Redis 3.0 and supports Redis 3.0 GEO commands. Currently, some commands are temporarily unavailable and restricted.

Supported command operations

Keys String Hash List Set SortedSet
DEL APPEND HDEL BLPOP SADD ZADD
DUMP BITCOUNT HEXISTS BRPOP SCARD ZCARD
EXISTS BITOP HGET BRPOPLPUSH SDIFF ZCOUNT
EXPIRE BITPOS HGETALL LINDEX SDIFFSTORE ZINCRBY
EXPIREAT DECR HINCRBY LINSERT SINTER ZRANGE
MOVE DECRBY HINCRBYFLOAT LLEN SINTERSTORE ZRANGEBYSCORE
PERSIST GET HKEYS LPOP SISMEMBER ZRANK
PEXPIRE GETBIT HLEN LPUSH SMEMBERS ZREM
PEXPTREAT GETRANGE HMGET LPUSHX SMOVE ZREMRANGEBYRANK
PTTL GETSET HMSET LRANGE SPOP ZREMRANGEBYSCORE
RANDOMKEY INCR HSET LREM SRANDMEMBER ZREVRANGE
RENAME INCRBY HSETNX LSET SREM ZREVRANGEBYSCORE
RENAMENX INCRBYFLOAT HVALS LTRIM SUNION ZREVRANK
RESTORE MGET HSCAN RPOP SUNIONSTORE ZSCORE
SORT MSET RPOPLPUSH SSCAN ZUNIONSTORE
TTL MSETNX RPUSH ZINTERSTORE
TYPE PSETEX RPUSHX ZSCAN
SCAN SET ZRANGEBYLEX
OBJECT SETBIT ZLEXCOUNT
SETEX ZREMRANGEBYLEX
SETNX
SETRANGE
STRLEN

And

HyperLogLog Pub/Sub (publish/subscription) Transaction Connection Server Scripting Geo (geological position)
PFADD PSUBSCRIBE DISCARD AUTH FLUSHALL EVAL GEOADD
PFCOUNT PUBLISH EXEC ECHO FLUSHDB EVALSHA GEOHASH
PFMERGE PUBSUB MULTI PING DBSIZE SCRIPT EXISTS GEOPOS
PUNSUBSCRIBE UNWATCH QUIT TIME SCRIPT FLUSH GEODIST
SUBSCRIBE WATCH SELECT INFO SCRIPT KILL GEORADIUS
UNSUBSCRIBE KEYS SCRIPT LOAD GEORADIUSBYMEMBER
CLIENT KILL
CLIENT LIST
CLIENT GETNAME
CLIENT SETNAME
CONFIG GET
MONITOR
SLOWLOG

Commands temporarily unavailable

Keys Server
MIGRATE BGREWRITEAOF
BGSAVE
CONFIG REWRITE
CONFIG SET
CONFIG RESETSTAT
COMMAND
COMMAND COUNT
COMMAND GETKEYS
COMMAND INFO
DEBUG OBJECT
DEBUG SEGFAULT
LASTSAVE
ROLE
SAVE
SHUTDOWN
SLAVEOF
SYNC

Commands restricted for cluster instances

Keys Strings Lists HyperLogLog Transaction Scripting
RENAME MSETNX RPOPLPUSH PFMERGE DISCARD EVAL
RENAMENX PFCOUNT EXEC EVALSHA
SORT MULTI SCRIPT EXISTS
UNWATCH SCRIPT FLUSH
WATCH SCRIPT KILL
WATCH SCRIPT LOAD

Self-developed commands for cluster instances

  • info key: Used to query the slot and DB of a key. The native info command of ApsaraDB for Redis can contain only one optional section (info [section]). Currently, some commands are restricted for the cluster instances of ApsaraDB for Redis. Therefore, all keys must be in the same slot. info key allows you to check whether keys are in the same slot. This command is used as follows:

    1. 127.0.0.1:6379> info key test_key
    2. slot:15118 db:0
  • iinfo: This command is similar to the info command. It is used to run info on a specified ApsaraDB for Redis node. This command is used as follows:

    iinfo db_idx [section]

    Note: The value range of db_idx is [0, nodecount), the value of nodecount is obtained by running info, and the value of section is set in the same way as the Redis standard optional parameters for the info command. For more information about how to use the iinfo command on an ApsaraDB for Redis node, see How to view the memory of a sub-instance of an ApsaraDB for Redis cluster.

  • riinfo: This command is similar to the iinfo command. It can be used only in read/write splitting mode. idx is added to specify the readonly slave on which the info command is run. In a read/write splitting cluster, idx is used to specify the readonly slave on which the info command is run. If idx is used in a non-read/write splitting cluster, an error is returned. This command is used as follows:

    riinfo db_idx ro_slave_idx [section]

Notes:

  • Restricted commands of cluster instances support only scenarios where keys to be operated are evenly distributed in a single hash slot and data of multiple hash slots are not merged. Therefore, you must use the hash tag to make sure that keys to be operated are evenly distributed in one hash slot.

    For example, if key1, aakey, and abkey3 are to be operated, you must save them in {key}1, aa{key}, and ab{key}3 modes. In this case, restricted commands can take effect when being called. For more information about how to use the hash tag, see the official documentation of ApsaraDB for Redis at: http://redis.io/topics/cluster-spec.

  • For more information about ApsaraDB for Redis commands, see the Official documentation.

Thank you! We've received your feedback.