Skip to content

Latest commit

 

History

History
463 lines (416 loc) · 57.6 KB

redis.md

File metadata and controls

463 lines (416 loc) · 57.6 KB

Redis Command Support

Keys Command

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|        DEL        |    Yes     | DEL key [key …]                                                                                                     |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       DUMP        |    Yes     | DUMP key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      EXISTS       |    Yes     | EXISTS key                                                                                                          |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      EXPIRE       |    Yes     | EXPIRE key seconds                                                                                                  |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     EXPIREAT      |    Yes     | EXPIREAT key timestamp                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       KEYS        |    No      | KEYS pattern                                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      MIGRATE      |    No      | MIGRATE host port key destination-db timeout                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       MOVE        |    No      | MOVE key db                                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      OBJECT       |    No      | OBJECT subcommand [arguments [arguments …]]                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      PERSIST      |    Yes     | PERSIST key                                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      PEXPIRE      |    Yes     | PEXPIRE key milliseconds                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     PEXPIREAT     |    Yes     | PEXPIREAT key milliseconds-timestamp                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      PTTL         |    Yes     | PTTL key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     RANDOMKEY     |    No      | RANDOMKEY                                                                                                           |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      RENAME       |    No      | RENAME key newkey                                                                                                   |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     RENAMENX      |    No      | RENAMENX key newkey                                                                                                 |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      RESTORE      |    Yes     | RESTORE key ttl serialized-value                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SORT         |    Yes     | SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]   |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       TTL         |    Yes     | TTL key                                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      TYPE         |    Yes     | TYPE key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SCAN         |    No      | SCAN cursor [MATCH pattern] [COUNT count]                                                                           |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+

Strings Command

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       APPEND      |    Yes     | APPEND key value                                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      BITCOUNT     |    Yes     | BITCOUNT key [start] [end]                                                                                          |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      BITPOS       |    Yes     | BITPOS key bit [start] [end]                                                                                          |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       BITOP       |    No      | BITOP operation destkey key [key ...]                                                                               |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       DECR        |    Yes     | DECR key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      DECRBY       |    Yes     | DECRBY key decrement                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       GET         |    Yes     | GET key                                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      GETBIT       |    Yes     | GETBIT key offset                                                                                                   |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     GETRANGE      |    Yes     | GETRANGE key start end                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      GETSET       |    Yes     | GETSET key value                                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      INCR         |    Yes     | INCR key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      INCRBY       |    Yes     | INCRBY key increment                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     INCRBYFLOAT   |    Yes     | INCRBYFLOAT key increment                                                                                           |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      MGET         |    Yes     | MGET key [key ...]                                                                                                  |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      MSET         |    Yes*    | MSET key value [key value ...]                                                                                      | 
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      MSETNX       |    No      | MSETNX key value [key value ...]                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      PSETEX       |    Yes     | PSETEX key milliseconds value                                                                                       |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SET          |    Yes     | SET key value [EX seconds] [PX milliseconds] [NX|XX]                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SETBIT       |    Yes     | SETBIT key offset value                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SETEX        |    Yes     | SETEX key seconds value                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SETNX        |    Yes     | SETNX key value                                                                                                     |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SETRANGE     |    Yes     | SETRANGE key offset value                                                                                           |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      STRLEN       |    Yes     | STRLEN key                                                                                                          |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
  • MSET support is not Atomic

Hashes

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       HDEL        |    Yes     | HDEL key field [field ...]                                                                                          |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HEXISTS      |    Yes     | HEXISTS key field                                                                                                   |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       HGET        |    Yes     | HGET key field                                                                                                      |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HGETALL      |    Yes     | HGETALL key                                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HINCRBY      |    Yes     | HINCRBY key field increment                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    HINCRBYFLOAT   |    Yes     | HINCRBYFLOAT key field increment                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HKEYS        |    Yes     | HKEYS key                                                                                                           |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HLEN         |    Yes     | HLEN key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HMGET        |    Yes     | HMGET key field [field ...]                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HMSET        |    Yes     | HMSET key field value [field value ...]                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HSET         |    Yes     | HSET key field value                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HSETNX       |    Yes     | HSETNX key field value                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HVALS        |    Yes     | HVALS key                                                                                                           |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      HSCAN        |    Yes     | HSCAN key cursor [MATCH pattern] [COUNT count]                                                                      |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+

Lists

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       BLPOP       |    No      | BLPOP key [key ...] timeout                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       BRPOP       |    No      | BRPOP key [key ...] timeout                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     BRPOPLPUSH    |    No      | BRPOPLPUSH source destination timeout                                                                               |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LINDEX       |    Yes     | LINDEX key index                                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LINSERT      |    Yes     | LINSERT key BEFORE|AFTER pivot value                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LLEN         |    Yes     | LLEN key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LPOP         |    Yes     | LPOP key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LPUSH        |    Yes     | LPUSH key value [value ...]                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LPUSHX       |    Yes     | LPUSHX key value                                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LRANGE       |    Yes     | LRANGE key start stop                                                                                               |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LREM         |    Yes     | LREM key count value                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LSET         |    Yes     | LSET key index value                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      LTRIM        |    Yes     | LTRIM key start stop                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      RPOP         |    Yes     | RPOP key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     RPOPLPUSH     |    Yes*    | RPOPLPUSH source destination                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      RPUSH        |    Yes     | RPUSH key value [value ...]                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      RPUSHX       |    Yes     | RPUSHX key value                                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
  • RPOPLPUSH support requires that source and destination keys hash to the same server. You can ensure this by using the same hashtag for source and destination key. Twemproxy does no checking on its end to verify that source and destination key hash to the same server, and the RPOPLPUSH command is forwarded to the server that the source key hashes to

Sets

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SADD         |    Yes     | SADD key member [member ...]                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SCARD        |    Yes     | SCARD key                                                                                                           |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SDIFF        |    Yes*    | SDIFF key [key ...]                                                                                                 |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     SDIFFSTORE    |    Yes*    | SDIFFSTORE destination key [key ...]                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SINTER       |    Yes*    | SINTER key [key ...]                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    SINTERSTORE    |    Yes*    | SINTERSTORE destination key [key ...]                                                                               |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     SISMEMBER     |    Yes     | SISMEMBER key member                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     SMEMBERS      |    Yes     | SMEMBERS key                                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SMOVE        |    Yes*    | SMOVE source destination member                                                                                     |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SPOP         |    Yes     | SPOP key                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    SRANDMEMBER    |    Yes     | SRANDMEMBER key [count]                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SREM         |    Yes     | SREM key member [member ...]                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     SUNION        |    Yes*    | SUNION key [key ...]                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|   SUNIONSTORE     |    Yes*    | SUNIONSTORE destination key [key ...]                                                                               |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SSCAN        |    Yes     | SSCAN key cursor [MATCH pattern] [COUNT count]                                                                      |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
  • SIDFF, SDIFFSTORE, SINTER, SINTERSTORE, SMOVE, SUNION and SUNIONSTORE support requires that the supplied keys hash to the same server. You can ensure this by using the same hashtag for all keys in the command. Twemproxy does no checking on its end to verify that all the keys hash to the same server, and the given command is forwarded to the server that the first key hashes to.

Sorted Sets

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      ZADD         |    Yes     | ZADD key score member [score] [member]                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      ZCARD        |    Yes     | ZCARD key                                                                                                           |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      ZCOUNT       |    Yes     | ZCOUNT key min max                                                                                                  |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      ZINCRBY      |    Yes     | ZINCRBY key increment member                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     ZINTERSTORE   |    Yes*    | ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]                 |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
|      ZLEXCOUNT    |    Yes     | ZLEXCOUNT key min max                                                                                               |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      ZRANGE       |    Yes     | ZRANGE key start stop [WITHSCORES]                                                                                  |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
|    ZRANGEBYLEX    |    Yes     | ZRANGEBYLEX key min max [LIMIT offset count]                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    ZRANGEBYSCORE  |    Yes     | ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      ZRANK        |    Yes     | ZRANK key member                                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       ZREM        |    Yes     | ZREM key member [member ...]                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|   ZREMRANGEBYLEX  |    Yes     | ZREMRANGEBYLEX key min max                                                                                          |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|   ZREMRANGEBYRANK |    Yes     | ZREMRANGEBYRANK key start stop                                                                                      |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|  ZREMRANGEBYSCORE |    Yes     | ZREMRANGEBYSCORE key min max                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    ZREVRANGE      |    Yes     | ZREVRANGE key start stop [WITHSCORES]                                                                               |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|  ZREVRANGEBYSCORE |    Yes     | ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]                                                      |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     ZREVRANK      |    Yes     | ZREVRANK key member                                                                                                 |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     ZSCORE        |    Yes     | ZSCORE key member                                                                                                   |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    ZUNIONSTORE    |    Yes*    | ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]                 |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      ZSCAN        |    Yes     | ZSCAN key cursor [MATCH pattern] [COUNT count]                                                                      |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
  • ZINTERSTORE and ZUNIONSTORE support requires that the supplied keys hash to the same server. You can ensure this by using the same hashtag for all keys in the command. Twemproxy does no checking on its end to verify that all the keys hash to the same server, and the given command is forwarded to the server that the first key hashes to.

HyperLogLog

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       PFADD       |    Yes     | PFADD key element [element ...]                                                                                     |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      PFCOUNT      |    Yes     | PFCOUNT key [key ...]                                                                                               |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      PFMERGE      |    Yes*    | PFMERGE destkey sourcekey [sourcekey ...]                                                                           |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
  • PFMERGE support requires that the supplied keys hash to the same server. You can ensure this by using the same hashtag for all keys in the command. Twemproxy does no checking on its end to verify that all the keys hash to the same server, and the given command is forwarded to the server that the first key hashes to.

Pub/Sub

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     PSUBSCRIBE    |    No      | PSUBSCRIBE pattern [pattern ...]                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     PUBLISH       |    No      | PUBLISH channel message                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    PUNSUBSCRIBE   |    No      | PUNSUBSCRIBE [pattern [pattern ...]]                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     SUBSCRIBE     |    No      | SUBSCRIBE channel [channel ...]                                                                                     |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     UNSUBSCRIBE   |    No      | UNSUBSCRIBE [channel [channel ...]]                                                                                 |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+

Transactions

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      DISCARD      |    No      | DISCARD                                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       EXEC        |    No      | EXEC                                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       MULTI       |    No      | MULTI                                                                                                               |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      UNWATCH      |    No      | UNWATCH                                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       WATCH       |    No      | WATCH key [key ...]                                                                                                 |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+

Scripting

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       EVAL        |    Yes*    | EVAL script numkeys key [key ...] arg [arg ...]                                                                     |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     EVALSHA       |    Yes*    | EVALSHA sha1 numkeys key [key ...] arg [arg ...]                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    SCRIPT EXISTS  |    No      | SCRIPT EXISTS script [script ...]                                                                                   |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    SCRIPT FLUSH   |    No      | SCRIPT FLUSH                                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    SCRIPT KILL    |    No      | SCRIPT KILL                                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    SCRIPT LOAD    |    No      | SCRIPT LOAD script                                                                                                  |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
  • EVAL and EVALSHA support is limited to scripts that take at least 1 key. If multiple keys are used, all keys must hash to the same server. You can ensure this by using the same hashtag for all keys. If you use more than 1 key, the proxy does no checking to verify that all keys hash to the same server, and the entire command is forwarded to the server that the first key hashes to

Connection

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       AUTH        |    No      | AUTH password                                                                                                       |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       ECHO        |    No      | ECHO message                                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       PING        |    Yes     | PING                                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|       QUIT        |    Yes     | QUIT                                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SELECT       |    No      | SELECT index                                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+

Server

+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      Command      | Supported? | Format                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    BGREWRITEAOF   |    No      | BGREWRITEAOF                                                                                                        |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      BGSAVE       |    No      | BGSAVE                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    CLIENT KILL    |    No      | CLIENT KILL ip:port                                                                                                 |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    CLIENT LIST    |    No      | CLIENT LIST                                                                                                         |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    CONFIG GET     |    No      | CONFIG GET parameter                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    CONFIG SET     |    No      | CONFIG SET parameter value                                                                                          |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|  CONFIG RESETSTAT |    No      | CONFIG RESETSTAT                                                                                                    |
+-------------------+-------------+--------------------------------------------------------------------------------------------------------------------+
|     DBSIZE        |    No      | DBSIZE                                                                                                              |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    DEBUG OBJECT   |    No      | DEBUG OBJECT key                                                                                                    |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|    DEBUG SEGFAULT |    No      | DEBUG SEGFAULT                                                                                                      |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     FLUSHALL      |    No      | FLUSHALL                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     FLUSHDB       |    No      | FLUSHDB                                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      INFO         |    No      | INFO                                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     LASTSAVE      |    No      | LASTSAVE                                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     MONITOR       |    No      | MONITOR                                                                                                             |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SAVE         |    No      | SAVE                                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     SHUTDOWN      |    No      | SHUTDOWN [NOSAVE] [SAVE]                                                                                            |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     SLAVEOF       |    No      | SLAVEOF host port                                                                                                   |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|     SLOWLOG       |    No      | SLOWLOG subcommand [argument]                                                                                       |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      SYNC         |    No      | SYNC                                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
|      TIME         |    No      | TIME                                                                                                                |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+

Note

  • redis commands are not case sensitive
  • only vectored commands 'MGET key [key ...]', 'MSET key value [key value ...]', 'DEL key [key ...]' needs to be fragmented

Performance

Setup

  • redis-server running on machine A.
  • nutcracker running on machine A as a local proxy to redis-server.
  • redis-benchmark running on machine B.
  • machine A != machine B.
  • nutcracker built with --enable-debug=no
  • nutcracker running with mbuf-size of 512 (-m 512)
  • redis-server built from redis 2.6 branch

redis-benchmark against redis-server

$ redis-benchmark -h <machine-A> -q -t set,get,incr,lpush,lpop,sadd,spop,lpush,lrange -c 100 -p 6379
SET: 89285.71 requests per second
GET: 92592.59 requests per second
INCR: 89285.71 requests per second
LPUSH: 90090.09 requests per second
LPOP: 90090.09 requests per second
SADD: 90090.09 requests per second
SPOP: 93457.95 requests per second
LPUSH (needed to benchmark LRANGE): 89285.71 requests per second
LRANGE_100 (first 100 elements): 36496.35 requests per second
LRANGE_300 (first 300 elements): 15748.03 requests per second
LRANGE_500 (first 450 elements): 11135.86 requests per second
LRANGE_600 (first 600 elements): 8650.52 requests per second

redis-benchmark against nutcracker proxing redis-server

$ redis-benchmark -h <machine-A> -q -t set,get,incr,lpush,lpop,sadd,spop,lpush,lrange -c 100 -p 22121
SET: 85470.09 requests per second
GET: 86956.52 requests per second
INCR: 85470.09 requests per second
LPUSH: 84745.77 requests per second
LPOP: 86206.90 requests per second
SADD: 84745.77 requests per second
SPOP: 86956.52 requests per second
LPUSH (needed to benchmark LRANGE): 84745.77 requests per second
LRANGE_100 (first 100 elements): 29761.90 requests per second
LRANGE_300 (first 300 elements): 12376.24 requests per second
LRANGE_500 (first 450 elements): 8605.85 requests per second
LRANGE_600 (first 600 elements): 6587.62 requests per second

redis-auth feature

  • you can enable redis-auth for a pool with 'redis_auth':

      alpha:
        listen: 127.0.0.1:22121
        hash: fnv1a_64
        distribution: ketama
        redis: true
        redis_auth: testpass
    
  • notice:

    • MUST set all redis with a same passwd, and all twemproxy with the same passwd
    • Length of password should less than 256