DCS Redis5.0基于开源5.0.14版本进行开发,兼容开源的协议和命令。
本章节主要介绍DCS Redis5.0命令的兼容性,包括支持命令列表,禁用命令列表。命令的具体详细语法,请前往Redis官方网站查看。
DCS Redis缓存实例支持Redis的绝大部分命令,任何兼容Redis协议的客户端都可以访问DCS。
- 因安全原因,部分Redis命令在分布式缓存服务中被禁用,具体请见Redis5.0禁用的命令。
- DCS集群实例支持多个key,但不支持跨slot访问的Redis命令列表,如实例受限使用命令所示。
- 部分Redis命令使用时有限制,具体请见部分命令使用限制。
Redis5.0支持的命令
- 下表列举了Redis 5.0单机、主备、Cluster集群实例支持的命令。
- 下表列举了Redis 5.0 proxy集群支持的命令。
- 下表列举了Redis 5.0读写分离支持的命令。
说明
Redis高版本的命令,在低版本中不被兼容。判断DCS Redis是否支持某个命令,可通过在Redis-cli执行该命令,如果得到(error)ERR unknown command ‘xxx’的提示,则说明不支持该命令。
Redis 5.0 Cluster版本集群实例使用pipeline时,要确保管道中的命令都能在同一分片执行。
表 Redis5.0 单机、主备、Cluster集群支持命令清单
Keys | String | Hash | List | Set | Sorted Set | Server |
---|---|---|---|---|---|---|
DEL | APPEND | HDEL | BLPOP | SADD | ZADD | FLUSHALL |
DUMP | BITCOUNT | HEXISTS | BRPOP | SCARD | ZCARD | FLUSHDB |
EXISTS | BITOP | HGET | BRPOPLRUSH | SDIFF | ZCOUNT | DBSIZE |
EXPIRE | BITPOS | HGETALL | LINDEX | SDIFFSTORE | ZINCRBY | TIME |
MOVE | DECR | HINCRBY | LINSERT | SINTER | ZRANGE | INFO |
PERSIST | DECRBY | HINCRBYFLOAT | LLEN | SINTERSTORE | ZRANGEBYSCORE | KEYS |
PTTL | GET | HKEYS | LPOP | SISMEMBER | ZRANK | CLIENT KILL |
RANDOMKEY | GETRANGE | HMGET | LPUSHX | SMEMBERS | ZREMRANGEBYRANK | CLIENT LIST |
RENAME | GETSET | HMSET | LRANGE | SMOVE | ZREMRANGEBYCORE | CLIENT GETNAME |
RENAMENX | INCR | HSET | LREM | SPOP | ZREVRANGE | CLIENT SETNAME |
RESTORE | INCRBY | HSETNX | LSET | SRANDMEMBER | ZREVRANGEBYSCORE | CONFIG GET |
SORT | INCRBYFLOAT | HVALS | LTRIM | SREM | ZREVRANK | MONITOR |
TTL | MGET | HSCAN | RPOP | SUNION | ZSCORE | SLOWLOG |
TYPE | MSET | HSTRLEN | RPOPLPU | SUNIONSTORE | ZUNIONSTORE | ROLE |
SCAN | MSETNX | HLEN | RPOPLPUSH | SSCAN | ZINTERSTORE | SWAPDB |
OBJECT | PSETEX | - | RPUSH | - | ZSCAN | MEMORY |
PEXPIREAT | SET | - | RPUSHX | - | ZRANGEBYLEX | CONFIG |
PEXPIRE | SETBIT | - | LPUSH | - | ZLEXCOUNT | - |
- | SETEX | - | - | - | ZPOPMIN | - |
- | SETNX | - | - | - | ZPOPMAX | - |
- | SETRANGE | - | - | - | ZREMRANGEBYSCORE | - |
- | STRLEN | - | - | - | ZREM | - |
- | BITFIELD | - | - | - | - | - |
表 Redis5.0 单机、主备、Cluster集群支持命令清单
HyperLoglog | Pub/Sub | Transactions | Connection | Scripting | Geo | Stream |
---|---|---|---|---|---|---|
PFADD | PSUBSCRIBE | DISCARD | AUTH | EVAL | GEOADD | XACK |
PFCOUNT | PUBLISH | EXEC | ECHO | EVALSHA | GEOHASH | XADD |
PFMERGE | PUBSUB | MULTI | PING | SCRIPT EXISTS | GEOPOS | XCLAIM |
- | PUNSUBSCRIBE | UNWATCH | QUIT | SCRIPT FLUSH | GEODIST | XDEL |
- | SUBSCRIBE | WATCH | SELECT(Cluster集群实例不支持) | SCRIPT KILL | GEORADIUS | XGROUP |
- | UNSUBSCRIBE | - | - | SCRIPT LOAD | GEORADIUSBYMEMBER | XINFO |
- | - | - | - | - | - | XLEN |
- | - | - | - | - | - | XPENDING |
- | - | - | - | - | - | XRANGE |
- | - | - | - | - | - | XREAD |
- | - | - | - | - | - | XREADGROUP |
- | - | - | - | - | - | XREVRANGE |
- | - | - | - | - | - | XTRIM |
表 Redis 5.0 proxy集群支持命令清单
Keys | String | Hash | List | Set | Sorted Set | Server |
---|---|---|---|---|---|---|
DEL | APPEND | HDEL | BLPOP | SADD | ZADD | FLUSHALL |
DUMP | BITCOUNT | HEXISTS | BRPOP | SCARD | ZCARD | FLUSHDB |
EXISTS | BITOP | HGET | BRPOPLRUSH | SDIFF | ZCOUNT | DBSIZE |
EXPIRE | BITPOS | HGETALL | LINDEX | SDIFFSTORE | ZINCRBY | TIME |
MOVE | DECR | HINCRBY | LINSERT | SINTER | ZRANGE | INFO |
PERSIST | DECRBY | HINCRBYFLOAT | LLEN | SINTERSTORE | ZRANGEBYSCORE | ROLE |
PTTL | GET | HKEYS | LPOP | SISMEMBER | ZRANK | MEMORY |
RENAME | GETRANGE | HMGET | LPUSHX | SMEMBERS | ZREMRANGEBYRANK | COMMAND |
RENAMENX | GETSET | HMSET | LRANGE | SMOVE | ZREMRANGEBYCORE | COMMAND COUNT |
RESTORE | INCR | HSET | LREM | SPOP | ZREVRANGE | COMMAND GETKEYS |
SORT | INCRBY | HSETNX | LSET | SRANDMEMBER | ZREVRANGEBYSCORE | COMMAND INFO |
TTL | INCRBYFLOAT | HVALS | LTRIM | SREM | ZREVRANK | CONFIG GET |
TYPE | MGET | HSCAN | RPOP | SUNION | ZSCORE | CONFIG RESETSTAT |
SCAN | MSET | HSTRLEN | RPOPLPUSH | SUNIONSTORE | ZUNIONSTORE | CONFIG REWRITE |
OBJECT | MSETNX | HLEN | RPUSH | SSCAN | ZINTERSTORE | CONFIG SET |
PEXPIRE | PSETEX | HKEYS | RPUSHX | - | ZSCAN | - |
PEXPIREAT | SET | - | LPUSH | - | ZRANGEBYLEX | - |
EXPIREAT | SETBIT | - | - | - | ZLEXCOUNT | - |
KEYS | SETEX | - | - | - | ZREMRANGEBYSCORE | - |
MIGRATE | SETNX | - | - | - | ZREM | - |
UNLINK | SETRANGE | - | - | - | ZREMRANGEBYLEX | - |
TOUCH | STRLEN | - | - | - | ZPOPMAX | - |
- | BITFIELD | - | - | - | ZPOPMIN | - |
- | GETBIT | - | - | - | BZPOPMAX | - |
- | - | - | - | - | BZPOPMIN | - |
- | - | - | - | - | ZREVRANGEBYLEX | - |
表 Redis 5.0 proxy集群支持命令清单
HyperLoglog | Pub/Sub | Transactions | Connection | Scripting | Geo |
---|---|---|---|---|---|
PFADD | PSUBSCRIBE | DISCARD | AUTH | EVAL | GEOADD |
PFCOUNT | PUBLISH | EXEC | ECHO | EVALSHA | GEOHASH |
PFMERGE | PUBSUB | MULTI | PING | SCRIPT EXISTS | GEOPOS |
- | PUNSUBSCRIBE | UNWATCH | QUIT | SCRIPT FLUSH | GEODIST |
- | SUBSCRIBE | WATCH | CLIENT KILL | SCRIPT KILL | GEORADIUS |
- | UNSUBSCRIBE | - | CLIENT LIST | SCRIPT LOAD | GEORADIUSBYMEMBER |
- | - | - | CLIENT GETNAME | SCRIPT DEBUG YES | SYNC |
- | - | - | CLIENT SETNAME | - | GEOSEARCHSTORE |
表 Redis 5.0读写分离支持命令清单
Keys | String | Hash | List | Set | Sorted Set | Server |
---|---|---|---|---|---|---|
DEL | APPEND | HDEL | BLPOP | SADD | ZADD | FLUSHALL |
DUMP | BITCOUNT | HEXISTS | BRPOP | SCARD | ZCARD | FLUSHDB |
EXISTS | BITOP | HGET | BRPOPLRUSH | SDIFF | ZCOUNT | DBSIZE |
EXPIRE | BITPOS | HGETALL | LINDEX | SDIFFSTORE | ZINCRBY | TIME |
MOVE | DECR | HINCRBY | LINSERT | SINTER | ZRANGE | INFO |
PERSIST | DECRBY | HINCRBYFLOAT | LLEN | SINTERSTORE | ZRANGEBYSCORE | MONITOR |
PTTL | GET | HKEYS | LPOP | SISMEMBER | ZRANK | SLOWLOG |
RANDOMKEY | GETRANGE | HMGET | LPUSHX | SMEMBERS | ZREMRANGEBYRANK | ROLE |
RENAME | GETSET | HMSET | LRANGE | SMOVE | ZREMRANGEBYCORE | SWAPDB |
RENAMENX | INCR | HSET | LREM | SPOP | ZREVRANGE | MEMORY |
RESTORE | INCRBY | HSETNX | LSET | SRANDMEMBER | ZREVRANGEBYSCORE | COMMAND |
SORT | INCRBYFLOAT | HVALS | LTRIM | SREM | ZREVRANK | COMMAND COUNT |
TTL | MGET | HSCAN | RPOP | SUNION | ZSCORE | COMMAND GETKEYS |
TYPE | MSET | HSTRLEN | RPOPLPUSH | SUNIONSTORE | ZUNIONSTORE | COMMAND INFO |
SCAN | MSETNX | HLEN | RPUSH | SSCAN | ZINTERSTORE | CONFIG GET |
OBJECT | PSETEX | - | RPUSHX | - | ZSCAN | CONFIG RESETSTAT |
PEXPIRE | SET | - | LPUSH | - | ZRANGEBYLEX | CONFIG REWRITE |
PEXPIREAT | SETBIT | - | - | - | ZLEXCOUNT | CONFIG SET |
EXPIREAT | SETEX | - | - | - | ZREMRANGEBYSCORE | - |
KEYS | SETNX | - | - | - | ZREM | - |
MIGRATE | SETRANGE | - | - | - | ZREMRANGEBYLEX | - |
UNLINK | STRLEN | - | - | - | BZPOPMAX | - |
TOUCH | BITFIELD | - | - | - | BZPOPMIN | - |
- | GETBIT | - | - | - | ZPOPMAX | - |
- | - | - | - | - | ZPOPMIN | - |
- | - | - | - | - | ZREVRANGEBYLEX | - |
[]()表1-6 Redis 5.0读写分离支持命令清单2
HyperLoglog | Pub/Sub | Transactions | Connection | Scripting | Geo |
---|---|---|---|---|---|
PFADD | PSUBSCRIBE | DISCARD | AUTH | EVAL | GEOADD |
PFCOUNT | PUBLISH | EXEC | ECHO | EVALSHA | GEOHASH |
PFMERGE | PUBSUB | MULTI | PING | SCRIPT EXISTS | GEOPOS |
- | PUNSUBSCRIBE | UNWATCH | QUIT | SCRIPT FLUSH | GEODIST |
- | SUBSCRIBE | WATCH | SELECT | SCRIPT KILL | GEORADIUS |
- | UNSUBSCRIBE | - | CLIENT KILL | SCRIPT LOAD | GEORADIUSBYMEMBER |
- | - | - | CLIENT LIST | SCRIPT DEBUG YES | SYNC |
- | - | - | CLIENT GETNAME | - | GEOSEARCHSTORE |
- | - | - | CLIENT SETNAME | - | - |
Redis5.0禁用的命令
以下列出了Redis5.0实例禁用的命令。
表 Redis 5.0单机和主备禁用命令
Keys | Server |
---|---|
MIGRATE | SLAVEOF |
- | SHUTDOWN |
- | LASTSAVE |
- | DEBUG相关类 |
- | COMMAND |
- | SAVE |
- | BGSAVE |
- | BGREWRITEAOF |
- | SYNC |
- | PSYNC |
表 Redis 5.0 Proxy集群实例禁用命令
Keys | Server | Sorted Set | Cluster |
---|---|---|---|
MIGRATE | BGREWRITEAOF | - | READONLY |
MOVE | BGSAVE | - | READWRITE |
RANDOMKEY | CLIENT相关命令 | - | - |
WAIT | DEBUG OBJECT | - | - |
- | DEBUG SEGFAULT | - | - |
- | LASTSAVE | - | - |
- | PSYNC | - | - |
- | SAVE | - | - |
- | SHUTDOWN | - | - |
- | SLAVEOF | - | - |
- | LATENCY相关命令 | - | - |
- | MODULE相关命令 | - | - |
- | LOLWUT | - | - |
- | SWAPDB | - | - |
- | REPLICAOF | - | - |
- | SYNC | - | - |
表 Redis5.0 Cluster集群禁用命令
Keys | Server | Cluster |
---|---|---|
MIGRATE | SLAVEOF | CLUSTER MEET |
- | SHUTDOWN | CLUSTER FLUSHSLOTS |
- | LASTSAVE | CLUSTER ADDSLOTS |
- | DEBUG相关类 | CLUSTER DELSLOTS |
- | COMMAND | CLUSTER SETSLOT |
- | SAVE | CLUSTER BUMPEPOCH |
- | BGSAVE | CLUSTER SAVECONFIG |
- | BGREWRITEAOF | CLUSTER FORGET |
- | SYNC | CLUSTER REPLICATE |
- | PSYNC | CLUSTER COUNT-FAILURE-REPORTS |
- | - | CLUSTER FAILOVER |
- | - | CLUSTER SET-CONFIG-EPOCH |
- | - | CLUSTER RESET |
表 Redis 5.0读写分离禁用命令
Cluster | Keys | Server |
---|---|---|
READONLY | MIGRATE | BGREWRITEAOF |
READWRITE | WAIT | BGSAVE |
- | - | DEBUG OBJECT |
- | - | DEBUG SEGFAULT |
- | - | LASTSAVE |
- | - | LOLWUT |
- | - | MODULE LIST/LOAD/UNLOAD |
- | - | PSYNC |
- | - | REPLICAOF |
- | - | SAVE |
- | - | SHUTDOWN [NOSAVE |
- | - | SLAVEOF |
- | - | SWAPDB |
- | - | SYNC |