命令兼容性
# 各版本命令兼容性列表
下表中 ✓ 表示支持,x 表示不支持,- 表示该命令不存在跨 Slot 访问的场景。
说明:
- 说明1:对于Redis社区集群版,代理会自动将多Key命令拆分成多个单Key命令分别发送到对应的后端Redis节点,从而导致原子语义的丧失。此外如果有部分Redis节点失败,错误信息有可能被抛弃,客户端收到的是一个成功的结果。
- 说明2:对于Redis社区集群版,代理会将命令发送给所有后端Redis节点,只要有其中一个节点返回错误结果,代理就会给客户端返回错误结果。
- 说明3:对于Redis社区集群版,部分返回结果是多个后端Redis节点信息的聚合值。如果将此命令放到lua脚本或事务中来执行则会返回原始redis节点的信息而无聚合效果。比如info memory,内存计量信息是后端所有主节点内存容量的聚合。
- 说明4:为了尽可能的提高代理性能,在内部实现中针对阻塞式命令、事务命令、发布订阅命令会采用特殊处理,因此这些命令不能和其它命令一起pipeline执行。
注: 以上限制不适用于业务直连Redis场景。
命令族 | 命令 | 2.8版本(主从架构) | 4.0版本(主从架构) | 4.0版本(集群架构) | 5.0版本(标准架构) | 5.0版本(集群架构) | 集群版跨 Slot 支持 | 说明 |
---|---|---|---|---|---|---|---|---|
connection 族 | auth | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
connection 族 | echo | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
connection 族 | ping | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
connection 族 | quit | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
connection 族 | select | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
connection 族 | swapdb | x | ✓ | x | ✓ | x | - | |
hash 族 | hdel | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hexists | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hget | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hgetall | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hincrby | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hincrbyfloat | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hkeys | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hlen | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hmget | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hmset | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hset | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hsetnx | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hstrlen | x | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hvals | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hash 族 | hscan | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | del | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 说明1 |
keys 族 | scan | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
keys 族 | exists | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 说明1 |
keys 族 | expire | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | expireat | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | keys | ✓ | ✓ | ✓ | ✓ | ✓ | - | 说明3 |
keys 族 | type | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | move | ✓ | ✓ | ✓ | ✓ | x | x | |
keys 族 | ttl | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | persist | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | pexpire | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | pexpireat | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | pttl | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | randomkey | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | rename | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
keys 族 | renamenx | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
keys 族 | sort | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | touch | x | ✓ | ✓ | ✓ | ✓ | ✓ | 说明1 |
keys 族 | restore | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | object | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | unlink | x | ✓ | ✓ | ✓ | ✓ | ✓ | 说明1 |
keys 族 | wait | x | ✓ | ✓ | ✓ | ✓ | - | 由于WAIT命令的语义和连接相关,客户端通过代理和redis的连接和直连redis不一样,所以该命令语义已改变,因此不建议使用 |
keys 族 | migrate | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
keys 族 | dump | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | lindex | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | linsert | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | llen | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | lpop | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | lpush | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | lpushx | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | lrange | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | lrem | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | lset | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | ltrim | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | rpop | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | rpoplpush | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
list 族 | rpush | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | rpushx | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
list 族 | blpop | ✓ | ✓ | ✓ | ✓ | ✓ | x | 说明4 |
list 族 | brpop | ✓ | ✓ | ✓ | ✓ | ✓ | x | 说明4 |
list 族 | brpoplpush | ✓ | ✓ | ✓ | ✓ | ✓ | x | 说明4 |
pub/sub 族 | psubscribe | ✓ | ✓ | ✓ | ✓ | ✓ | - | 说明4 |
pub/sub 族 | pubsub | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
pub/sub 族 | publish | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
pub/sub 族 | punsubscribe | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
pub/sub 族 | subscribe | ✓ | ✓ | ✓ | ✓ | ✓ | - | 说明4 |
pub/sub 族 | unsubscribe | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sets 族 | sadd | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sets 族 | scard | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sets 族 | sdiff | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
sets 族 | sdiffstore | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
sets 族 | sinter | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
sets 族 | sinterstore | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
sets 族 | sismember | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sets 族 | smembers | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sets 族 | smove | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
sets 族 | spop | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sets 族 | srandmember | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sets 族 | srem | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sets 族 | sscan | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sets 族 | sunion | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
sets 族 | sunionstore | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
sorted sets 族 | zadd | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zcard | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zcount | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zincrby | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zinterstore | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
sorted sets 族 | zlexcount | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zrange | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zrangebylex | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zrangebyscore | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zrank | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zrem | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zremrangebylex | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zremrangebyrank | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zremrangebyscore | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zrevrange | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zrevrangebylex | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zrevrangebyscore | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zscore | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zrevrank | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zscan | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
sorted sets 族 | zunionstore | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
sorted sets 族 | zpopmax | x | x | x | ✓ | ✓ | - | |
sorted sets 族 | zpopmin | x | x | x | ✓ | ✓ | - | |
sorted sets 族 | bzpopmax | x | x | x | ✓ | ✓ | - | 说明4 |
sorted sets 族 | bzpopmin | x | x | x | ✓ | ✓ | - | 说明4 |
strings 族 | append | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | bitcount | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | bitop | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
strings 族 | bitpos | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | decr | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | decrby | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | get | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | getbit | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | getrange | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | getset | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | incr | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | incrby | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | incrbyfloat | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | mget | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 说明1 |
strings 族 | mset | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 说明1 |
strings 族 | msetnx | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 说明1 |
strings 族 | psetex | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | setex | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | set | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | setbit | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | setnx | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | setrange | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | strlen | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
strings 族 | bitfield | x | ✓ | ✓ | ✓ | ✓ | - | |
transactions 族 | discard | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
transactions 族 | exec | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
transactions 族 | multi | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
transactions 族 | unwatch | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
transactions 族 | watch | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hyperloglog 族 | pfadd | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
hyperloglog 族 | pfcount | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
hyperloglog 族 | pfmerge | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
scripting 族 | eval | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
scripting 族 | evalsha | ✓ | ✓ | ✓ | ✓ | ✓ | x | |
scripting 族 | script debug | x | x | x | x | x | - | |
scripting 族 | script exists | ✓ | ✓ | ✓ | ✓ | ✓ | x | 说明2 |
scripting 族 | script flush | ✓ | ✓ | ✓ | ✓ | ✓ | - | 说明2 |
scripting 族 | script load | ✓ | ✓ | ✓ | ✓ | ✓ | - | 说明2 |
scripting 族 | script kill | ✓ | ✓ | ✓ | ✓ | ✓ | - | 说明2 |
geo 族 | geoadd | x | ✓ | ✓ | ✓ | ✓ | - | |
geo 族 | geohash | x | ✓ | ✓ | ✓ | ✓ | - | |
geo 族 | geopos | x | ✓ | ✓ | ✓ | ✓ | - | |
geo 族 | geodist | x | ✓ | ✓ | ✓ | ✓ | - | |
geo 族 | georadius | x | ✓ | ✓ | ✓ | ✓ | - | |
geo 族 | georadiusbymember | x | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | bgrewriteaof | x | x | x | x | x | - | |
server 族 | bgsave | x | x | x | x | x | - | |
server 族 | client kill | ✓ | ✓ | ✓ | ✓ | ✓ | - | 只支持按客户端地址kill |
server 族 | sync | x | x | x | x | x | - | |
server 族 | psync | x | x | x | x | x | - | |
server 族 | client list | ✓ | ✓ | ✓ | ✓ | ✓ | - | 返回的格式和redis原生格式有所不同,为自定义命令 |
server 族 | client getname | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | client pause | x | x | x | x | x | - | |
server 族 | client reply | x | x | x | x | x | - | |
server 族 | client setname | ✓ | ✓ | ✓ | ✓ | ✓ | - | 最大name长度限制为256字节 |
server 族 | command count | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | command getkeys | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | command info | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | command | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | slaveof | x | x | x | x | x | - | |
server 族 | config rewrite | ✓ | ✓ | × | ✓ | × | - | 说明2 |
server 族 | config set | ✓ | ✓ | × | ✓ | × | - | 说明3 |
server 族 | config get | ✓ | ✓ | × | ✓ | × | - | 说明3 |
server 族 | config resetstat | ✓ | ✓ | × | ✓ | × | - | 说明2 |
server 族 | debug object | x | x | x | x | x | - | |
server 族 | debug segfault | x | x | x | x | x | - | |
server 族 | role | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | save | x | x | x | x | x | - | |
server 族 | lastsave | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | shutdown | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | memory stats | x | ✓ | x | ✓ | x | - | |
server 族 | memory usage | x | ✓ | x | ✓ | x | - | |
server 族 | memory help | x | ✓ | x | ✓ | x | - | |
server 族 | memory purge | x | ✓ | x | ✓ | x | - | |
server 族 | memory malloc-stats | x | ✓ | x | ✓ | x | - | |
server 族 | memory doctor | x | ✓ | x | ✓ | x | - | |
server 族 | dbsize | ✓ | ✓ | x | ✓ | x | - | 说明3 |
server 族 | info | ✓ | ✓ | ✓ | ✓ | ✓ | - | 说明3 |
server 族 | time | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | monitor | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | flushdb | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | flushall | ✓ | ✓ | ✓ | ✓ | ✓ | - | |
server 族 | slowlog | ✓ | ✓ | x | ✓ | x | - | |
server 族 | cluster keyslot | x | x | ✓ | x | ✓ | - | |
server 族 | cluster nodes | x | x | ✓ | x | ✓ | - | |
server 族 | cluster slots | x | x | ✓ | x | ✓ | - | |
server 族 | cluster getkeysinslot | x | x | ✓ | x | ✓ | - | |
server 族 | cluster countkeysinslot | x | x | ✓ | x | ✓ | - | |
server 族 | cluster info | x | x | ✓ | x | ✓ | - | |
server 族 | cluster addslots | x | x | x | x | x | - | |
server 族 | cluster bumpepoch | x | x | x | x | x | - | |
server 族 | cluster count-failure-reports | x | x | x | x | x | - | |
server 族 | cluster bumpepoch | x | x | x | x | x | - | |
server 族 | cluster delslots | x | x | x | x | x | - | |
server 族 | cluster failover | x | x | x | x | x | - | |
server 族 | cluster flushslots | x | x | x | x | x | - | |
server 族 | cluster forget | x | x | x | x | x | - | |
server 族 | cluster meet | x | x | x | x | x | - | |
server 族 | cluster myid | x | x | x | x | x | - | |
server 族 | cluster replicas | x | x | x | x | x | - | |
server 族 | cluster reset | x | x | x | x | x | - | |
server 族 | cluster saveconfig | x | x | x | x | x | - | |
server 族 | cluster set-config-epoch | x | x | x | x | x | - | |
server 族 | cluster setslot | x | x | x | x | x | - | |
server 族 | cluster slaves | x | x | x | x | x | - | |
server 族 | module list | x | x | x | x | x | - | |
server 族 | module load | x | x | x | x | x | - | |
server 族 | module unload | x | x | x | x | x | - | |
server 族 | lolwut | x | x | x | ✓ | ✓ | - | |
Stream 族 | xinfo | x | x | x | ✓ | ✓ | - | |
Stream 族 | xadd | x | x | x | ✓ | ✓ | - | |
Stream 族 | xtrim | x | x | x | ✓ | ✓ | - | |
Stream 族 | xdel | x | x | x | ✓ | ✓ | - | |
Stream 族 | xrange | x | x | x | ✓ | ✓ | - | |
Stream 族 | xrevrange | x | x | x | ✓ | ✓ | - | |
Stream 族 | xlen | x | x | x | ✓ | ✓ | - | |
Stream 族 | xread | x | x | x | ✓ | ✓ | x | |
Stream 族 | xgroup | x | x | x | ✓ | ✓ | - | |
Stream 族 | xreadgroup | x | x | x | ✓ | ✓ | x | |
Stream 族 | xack | x | x | x | ✓ | ✓ | - | |
Stream 族 | xlclaim | x | x | x | ✓ | ✓ | - | |
Stream 族 | xpending | x | x | x | ✓ | ✓ | - | |
Stream 族 | xautoclaim | x | x | x | ✓ | ✓ | - | |
Stream 族 | xblockread | x | x | x | ✓ | ✓ | x | 说明4 |
Stream 族 | xblockreadgroup | x | x | x | ✓ | ✓ | x |