1## Redis Command Support
2
3### Keys Command
4
5    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
6    |      Command      | Supported? | Format                                                                                                              |
7    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
8    |        DEL        |    Yes     | DEL key [key …]                                                                                                     |
9    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
10    |       DUMP        |    Yes     | DUMP key                                                                                                            |
11    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
12    |      EXISTS       |    Yes     | EXISTS key                                                                                                          |
13    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
14    |      EXPIRE       |    Yes     | EXPIRE key seconds                                                                                                  |
15    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
16    |     EXPIREAT      |    Yes     | EXPIREAT key timestamp                                                                                              |
17    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
18    |       KEYS        |    No      | KEYS pattern                                                                                                        |
19    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
20    |      MIGRATE      |    No      | MIGRATE host port key destination-db timeout                                                                        |
21    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
22    |       MOVE        |    No      | MOVE key db                                                                                                         |
23    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
24    |      OBJECT       |    No      | OBJECT subcommand [arguments [arguments …]]                                                                         |
25    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
26    |      PERSIST      |    Yes     | PERSIST key                                                                                                         |
27    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
28    |      PEXPIRE      |    Yes     | PEXPIRE key milliseconds                                                                                            |
29    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
30    |     PEXPIREAT     |    Yes     | PEXPIREAT key milliseconds-timestamp                                                                                |
31    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
32    |      PTTL         |    Yes     | PTTL key                                                                                                            |
33    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
34    |     RANDOMKEY     |    No      | RANDOMKEY                                                                                                           |
35    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
36    |      RENAME       |    No      | RENAME key newkey                                                                                                   |
37    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
38    |     RENAMENX      |    No      | RENAMENX key newkey                                                                                                 |
39    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
40    |      RESTORE      |    Yes     | RESTORE key ttl serialized-value                                                                                    |
41    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
42    |      SORT         |    Yes     | SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]   |
43    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
44    |       TTL         |    Yes     | TTL key                                                                                                             |
45    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
46    |      TYPE         |    Yes     | TYPE key                                                                                                            |
47    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
48    |      SCAN         |    No      | SCAN cursor [MATCH pattern] [COUNT count]                                                                           |
49    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
50
51### Strings Command
52
53    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
54    |      Command      | Supported? | Format                                                                                                              |
55    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
56    |      APPEND       |    Yes     | APPEND key value                                                                                                    |
57    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
58    |     BITCOUNT      |    Yes     | BITCOUNT key [start end]                                                                                            |
59    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
60    |     BITFIELD      |    Yes     | BITFIELD key [GET] [SET] [INCRBY] [WRAP|SAT|FAIL]                                                                   |
61    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
62    |       BITOP       |    No      | BITOP operation destkey key [key …]                                                                                 |
63    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
64    |      BITPOS       |    Yes     | BITPOS key bit [start] [end]                                                                                        |
65    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
66    |       DECR        |    Yes     | DECR key                                                                                                            |
67    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
68    |      DECRBY       |    Yes     | DECRBY key decrement                                                                                                |
69    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
70    |        GET        |    Yes     | GET key                                                                                                             |
71    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
72    |      GETBIT       |    Yes     | GETBIT key offset                                                                                                   |
73    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
74    |      GETDEL       |    Yes     | GETDEL key                                                                                                          |
75    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
76    |       GETEX       |    Yes     | GETEX key [EX seconds|PX milliseconds|EXAT timestamp|PXAT milliseconds-timestamp|PERSIST]                           |
77    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
78    |     GETRANGE      |    Yes     | GETRANGE key start end                                                                                              |
79    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
80    |      GETSET       |    Yes     | GETSET key value                                                                                                    |
81    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
82    |       INCR        |    Yes     | INCR key                                                                                                            |
83    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
84    |      INCRBY       |    Yes     | INCRBY key increment                                                                                                |
85    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
86    |    INCRBYFLOAT    |    Yes     | INCRBYFLOAT key increment                                                                                           |
87    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
88    |       MGET        |    Yes     | MGET key [key …]                                                                                                    |
89    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
90    |       MSET        |    Yes     | MSET key value [key value …]                                                                                        |
91    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
92    |      MSETNX       |    No      | MSETNX key value [key value …]                                                                                      |
93    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
94    |      PSETEX       |    Yes     | PSETEX key milliseconds value                                                                                       |
95    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
96    |        SET        |    Yes     | SET key value [EX seconds|PX milliseconds|EXAT timestamp|PXAT milliseconds-timestamp|KEEPTTL] [NX|XX] [GET]         |
97    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
98    |      SETBIT       |    Yes     | SETBIT key offset value                                                                                             |
99    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
100    |       SETEX       |    Yes     | SETEX key seconds value                                                                                             |
101    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
102    |       SETNX       |    Yes     | SETNX key value                                                                                                     |
103    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
104    |     SETRANGE      |    Yes     | SETRANGE key offset value                                                                                           |
105    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
106    |      STRALGO      |    No      | STRALGO LCS algo-specific-argument [algo-specific-argument …]                                                       |
107    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
108    |      STRLEN       |    Yes     | STRLEN key                                                                                                          |
109    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
110
111* MSET support is not Atomic
112
113### Hashes
114
115    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
116    |      Command      | Supported? | Format                                                                                                              |
117    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
118    |       HDEL        |    Yes     | HDEL key field [field ...]                                                                                          |
119    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
120    |      HEXISTS      |    Yes     | HEXISTS key field                                                                                                   |
121    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
122    |       HGET        |    Yes     | HGET key field                                                                                                      |
123    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
124    |      HGETALL      |    Yes     | HGETALL key                                                                                                         |
125    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
126    |      HINCRBY      |    Yes     | HINCRBY key field increment                                                                                         |
127    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
128    |    HINCRBYFLOAT   |    Yes     | HINCRBYFLOAT key field increment                                                                                    |
129    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
130    |      HKEYS        |    Yes     | HKEYS key                                                                                                           |
131    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
132    |      HLEN         |    Yes     | HLEN key                                                                                                            |
133    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
134    |      HMGET        |    Yes     | HMGET key field [field ...]                                                                                         |
135    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
136    |      HMSET        |    Yes     | HMSET key field value [field value ...]                                                                             |
137    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
138    |      HSET         |    Yes     | HSET key field value                                                                                                |
139    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
140    |      HSETNX       |    Yes     | HSETNX key field value                                                                                              |
141    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
142    |      HVALS        |    Yes     | HVALS key                                                                                                           |
143    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
144    |      HSCAN        |    Yes     | HSCAN key cursor [MATCH pattern] [COUNT count]                                                                      |
145    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
146
147### Lists
148
149    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
150    |      Command      | Supported? | Format                                                                                                              |
151    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
152    |      BLMOVE       |    No      | BLMOVE source destination LEFT|RIGHT LEFT|RIGHT timeout                                                             |
153    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
154    |       BLPOP       |    No      | BLPOP key [key …] timeout                                                                                           |
155    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
156    |       BRPOP       |    No      | BRPOP key [key …] timeout                                                                                           |
157    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
158    |    BRPOPLPUSH     |    No      | BRPOPLPUSH source destination timeout                                                                               |
159    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
160    |      LINDEX       |    Yes     | LINDEX key index                                                                                                    |
161    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
162    |      LINSERT      |    Yes     | LINSERT key BEFORE|AFTER pivot element                                                                              |
163    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
164    |       LLEN        |    Yes     | LLEN key                                                                                                            |
165    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
166    |       LMOVE       |    Yes     | LMOVE source destination LEFT|RIGHT LEFT|RIGHT                                                                      |
167    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
168    |       LPOP        |    Yes     | LPOP key [count]                                                                                                    |
169    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
170    |       LPOS        |    Yes     | LPOS key element [RANK] [COUNT] [MAXLEN]                                                                            |
171    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
172    |       LPUSH       |    Yes     | LPUSH key element [element …]                                                                                       |
173    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
174    |      LPUSHX       |    Yes     | LPUSHX key element [element …]                                                                                      |
175    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
176    |      LRANGE       |    Yes     | LRANGE key start stop                                                                                               |
177    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
178    |       LREM        |    Yes     | LREM key count element                                                                                              |
179    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
180    |       LSET        |    Yes     | LSET key index element                                                                                              |
181    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
182    |       LTRIM       |    Yes     | LTRIM key start stop                                                                                                |
183    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
184    |       RPOP        |    Yes     | RPOP key [count]                                                                                                    |
185    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
186    |     RPOPLPUSH     |    Yes*    | RPOPLPUSH source destination                                                                                        |
187    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
188    |       RPUSH       |    Yes     | RPUSH key element [element …]                                                                                       |
189    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
190    |      RPUSHX       |    Yes     | RPUSHX key element [element …]                                                                                      |
191    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
192
193* RPOPLPUSH support requires that source and destination keys hash to the same server. You can ensure this by using the same [hashtag](recommendation.md#hash-tags) 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
194
195### Sets
196
197    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
198    |      Command      | Supported? | Format                                                                                                              |
199    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
200    |       SADD        |    Yes     | SADD key member [member …]                                                                                          |
201    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
202    |       SCARD       |    Yes     | SCARD key                                                                                                           |
203    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
204    |       SDIFF       |    Yes*    | SDIFF key [key …]                                                                                                   |
205    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
206    |    SDIFFSTORE     |    Yes*    | SDIFFSTORE destination key [key …]                                                                                  |
207    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
208    |      SINTER       |    Yes*    | SINTER key [key …]                                                                                                  |
209    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
210    |    SINTERSTORE    |    Yes*    | SINTERSTORE destination key [key …]                                                                                 |
211    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
212    |     SISMEMBER     |    Yes     | SISMEMBER key member                                                                                                |
213    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
214    |     SMEMBERS      |    Yes     | SMEMBERS key                                                                                                        |
215    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
216    |    SMISMEMBER     |    Yes     | SMISMEMBER key member [member …]                                                                                    |
217    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
218    |       SMOVE       |    Yes*    | SMOVE source destination member                                                                                     |
219    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
220    |       SPOP        |    Yes     | SPOP key [count]                                                                                                    |
221    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
222    |    SRANDMEMBER    |    Yes     | SRANDMEMBER key [count]                                                                                             |
223    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
224    |       SREM        |    Yes     | SREM key member [member …]                                                                                          |
225    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
226    |       SSCAN       |    Yes     | SSCAN key cursor [MATCH] [COUNT]                                                                                    |
227    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
228    |      SUNION       |    Yes*    | SUNION key [key …]                                                                                                  |
229    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
230    |    SUNIONSTORE    |    Yes*    | SUNIONSTORE destination key [key …]                                                                                 |
231    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
232
233* 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](recommendation.md#hash-tags) 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.
234
235
236### Sorted Sets
237
238    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
239    |      Command      | Supported? | Format                                                                                                              |
240    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
241    |     BZPOPMAX      |    No      | BZPOPMAX key [key …] timeout                                                                                        |
242    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
243    |     BZPOPMIN      |    No      | BZPOPMIN key [key …] timeout                                                                                        |
244    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
245    |       ZADD        |    Yes     | ZADD key [NX|XX] [GT|LT] [CH] [INCR] score member [score member …]                                                  |
246    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
247    |       ZCARD       |    Yes     | ZCARD key                                                                                                           |
248    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
249    |      ZCOUNT       |    Yes     | ZCOUNT key min max                                                                                                  |
250    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
251    |       ZDIFF       |    Yes*    | ZDIFF numkeys key [key …] [WITHSCORES]                                                                              |
252    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
253    |    ZDIFFSTORE     |    Yes*    | ZDIFFSTORE destination numkeys key [key …]                                                                          |
254    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
255    |      ZINCRBY      |    Yes     | ZINCRBY key increment member                                                                                        |
256    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
257    |      ZINTER       |    Yes*    | ZINTER numkeys key [key …] [WEIGHTS] [SUM|MIN|MAX] [WITHSCORES]                                                     |
258    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
259    |    ZINTERSTORE    |    Yes*    | ZINTERSTORE destination numkeys key [key …] [WEIGHTS] [SUM|MIN|MAX]                                                 |
260    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
261    |     ZLEXCOUNT     |    Yes     | ZLEXCOUNT key min max                                                                                               |
262    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
263    |      ZMSCORE      |    Yes     | ZMSCORE key member [member …]                                                                                       |
264    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
265    |      ZPOPMAX      |    Yes     | ZPOPMAX key [count]                                                                                                 |
266    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
267    |      ZPOPMIN      |    Yes     | ZPOPMIN key [count]                                                                                                 |
268    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
269    |    ZRANDMEMBER    |    Yes     | ZRANDMEMBER key [options]                                                                                           |
270    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
271    |      ZRANGE       |    Yes     | ZRANGE key min max [BYSCORE|BYLEX] [REV] [LIMIT] [WITHSCORES]                                                       |
272    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
273    |    ZRANGEBYLEX    |    Yes     | ZRANGEBYLEX key min max [LIMIT]                                                                                     |
274    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
275    |   ZRANGEBYSCORE   |    Yes     | ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT]                                                                      |
276    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
277    |    ZRANGESTORE    |    Yes     | ZRANGESTORE dst src min max [BYSCORE|BYLEX] [REV] [LIMIT]                                                           |
278    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
279    |       ZRANK       |    Yes     | ZRANK key member                                                                                                    |
280    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
281    |       ZREM        |    Yes     | ZREM key member [member …]                                                                                          |
282    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
283    |  ZREMRANGEBYLEX   |    Yes     | ZREMRANGEBYLEX key min max                                                                                          |
284    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
285    |  ZREMRANGEBYRANK  |    Yes     | ZREMRANGEBYRANK key start stop                                                                                      |
286    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
287    | ZREMRANGEBYSCORE  |    Yes     | ZREMRANGEBYSCORE key min max                                                                                        |
288    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
289    |     ZREVRANGE     |    Yes     | ZREVRANGE key start stop [WITHSCORES]                                                                               |
290    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
291    |  ZREVRANGEBYLEX   |    Yes     | ZREVRANGEBYLEX key max min [LIMIT]                                                                                  |
292    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
293    | ZREVRANGEBYSCORE  |    Yes     | ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT]                                                                   |
294    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
295    |     ZREVRANK      |    Yes     | ZREVRANK key member                                                                                                 |
296    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
297    |       ZSCAN       |    Yes     | ZSCAN key cursor [MATCH] [COUNT]                                                                                    |
298    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
299    |      ZSCORE       |    Yes     | ZSCORE key member                                                                                                   |
300    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
301    |      ZUNION       |    Yes*    | ZUNION numkeys key [key …] [WEIGHTS] [SUM|MIN|MAX] [WITHSCORES]                                                     |
302    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
303    |    ZUNIONSTORE    |    Yes*    | ZUNIONSTORE destination numkeys key [key …] [WEIGHTS] [SUM|MIN|MAX]                                                 |
304    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
305
306* ZINTERSTORE and ZUNIONSTORE support requires that the supplied keys hash to the same server. You can ensure this by using the same [hashtag](recommendation.md#hash-tags) 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.
307
308### HyperLogLog
309
310    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
311    |      Command      | Supported? | Format                                                                                                              |
312    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
313    |       PFADD       |    Yes     | PFADD key element [element …]                                                                                       |
314    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
315    |      PFCOUNT      |    Yes     | PFCOUNT key [key …]                                                                                                 |
316    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
317    |      PFMERGE      |    Yes*    | PFMERGE destkey sourcekey [sourcekey …]                                                                             |
318    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
319
320* PFMERGE support requires that the supplied keys hash to the same server. You can ensure this by using the same [hashtag](recommendation.md#hash-tags) 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.
321
322### Geo Command
323
324    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
325    |      Command      | Supported? | Format                                                                                                              |
326    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
327    |      GEOADD       |    Yes     | GEOADD key [NX|XX] [CH] longitude latitude member [longitude latitude member …]                                     |
328    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
329    |      GEODIST      |    Yes     | GEODIST key member1 member2 [m|km|ft|mi]                                                                            |
330    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
331    |      GEOHASH      |    Yes     | GEOHASH key member [member …]                                                                                       |
332    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
333    |      GEOPOS       |    Yes     | GEOPOS key member [member …]                                                                                        |
334    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
335    |     GEORADIUS     |    Yes     | GEORADIUS key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [count] [ASC|DESC] [STORE] [STOREDIST]|
336    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
337    | GEORADIUSBYMEMBER |    Yes     | GEORADIUSBYMEMBER key member radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [count] [ASC|DESC] [STORE] [STOREDIST]|
338    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
339    |     GEOSEARCH     |    Yes     | GEOSEARCH key [FROMMEMBER] [FROMLONLAT] [circle] [box] [ASC|DESC] [count] [WITHCOORD] [WITHDIST] [WITHHASH]         |
340    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
341    |  GEOSEARCHSTORE   |    Yes     | GEOSEARCHSTORE destination source [FROMMEMBER] [FROMLONLAT] [circle] [box] [ASC|DESC] [count] [WITHCOORD] [WITHDIST] [WITHHASH] [STOREDIST]|
342    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
343
344### Pub/Sub
345
346    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
347    |      Command      | Supported? | Format                                                                                                              |
348    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
349    |    PSUBSCRIBE     |    No      | PSUBSCRIBE pattern [pattern …]                                                                                      |
350    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
351    |      PUBLISH      |    No      | PUBLISH channel message                                                                                             |
352    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
353    |      PUBSUB       |    No      | PUBSUB subcommand [argument [argument …]]                                                                           |
354    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
355    |   PUNSUBSCRIBE    |    No      | PUNSUBSCRIBE [pattern [pattern …]]                                                                                  |
356    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
357    |     SUBSCRIBE     |    No      | SUBSCRIBE channel [channel …]                                                                                       |
358    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
359    |    UNSUBSCRIBE    |    No      | UNSUBSCRIBE [channel [channel …]]                                                                                   |
360    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
361
362### Transactions
363
364    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
365    |      Command      | Supported? | Format                                                                                                              |
366    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
367    |      DISCARD      |    No      | DISCARD                                                                                                             |
368    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
369    |       EXEC        |    No      | EXEC                                                                                                                |
370    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
371    |       MULTI       |    No      | MULTI                                                                                                               |
372    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
373    |      UNWATCH      |    No      | UNWATCH                                                                                                             |
374    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
375    |       WATCH       |    No      | WATCH key [key …]                                                                                                   |
376    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
377
378### Scripting
379
380    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
381    |      Command      | Supported? | Format                                                                                                              |
382    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
383    |       EVAL        |    Yes*    | EVAL script numkeys key [key …] arg [arg …]                                                                         |
384    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
385    |      EVALSHA      |    Yes*    | EVALSHA sha1 numkeys key [key …] arg [arg …]                                                                        |
386    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
387    |   SCRIPT DEBUG    |    No      | SCRIPT DEBUG YES|SYNC|NO                                                                                            |
388    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
389    |   SCRIPT EXISTS   |    No      | SCRIPT EXISTS sha1 [sha1 …]                                                                                         |
390    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
391    |   SCRIPT FLUSH    |    No      | SCRIPT FLUSH [ASYNC|SYNC]                                                                                           |
392    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
393    |    SCRIPT KILL    |    No      | SCRIPT KILL                                                                                                         |
394    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
395    |    SCRIPT LOAD    |    No      | SCRIPT LOAD script                                                                                                  |
396    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
397
398 * 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](recommendation.md#hash-tags) 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
399
400### Connection
401
402    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
403    |      Command      | Supported? | Format                                                                                                              |
404    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
405    |       AUTH        |    No      | AUTH password                                                                                                       |
406    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
407    |       ECHO        |    No      | ECHO message                                                                                                        |
408    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
409    |       PING        |    Yes     | PING                                                                                                                |
410    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
411    |       QUIT        |    Yes     | QUIT                                                                                                                |
412    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
413    |      SELECT       |    No      | SELECT index                                                                                                        |
414    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
415
416### Server
417
418    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
419    |      Command      | Supported? | Format                                                                                                              |
420    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
421    |    BGREWRITEAOF   |    No      | BGREWRITEAOF                                                                                                        |
422    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
423    |      BGSAVE       |    No      | BGSAVE                                                                                                              |
424    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
425    |    CLIENT KILL    |    No      | CLIENT KILL ip:port                                                                                                 |
426    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
427    |    CLIENT LIST    |    No      | CLIENT LIST                                                                                                         |
428    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
429    |    CONFIG GET     |    No      | CONFIG GET parameter                                                                                                |
430    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
431    |    CONFIG SET     |    No      | CONFIG SET parameter value                                                                                          |
432    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
433    |  CONFIG RESETSTAT |    No      | CONFIG RESETSTAT                                                                                                    |
434    +-------------------+-------------+--------------------------------------------------------------------------------------------------------------------+
435    |     DBSIZE        |    No      | DBSIZE                                                                                                              |
436    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
437    |    DEBUG OBJECT   |    No      | DEBUG OBJECT key                                                                                                    |
438    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
439    |    DEBUG SEGFAULT |    No      | DEBUG SEGFAULT                                                                                                      |
440    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
441    |     FLUSHALL      |    No      | FLUSHALL                                                                                                            |
442    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
443    |     FLUSHDB       |    No      | FLUSHDB                                                                                                             |
444    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
445    |      INFO         |    No      | INFO                                                                                                                |
446    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
447    |     LASTSAVE      |    No      | LASTSAVE                                                                                                            |
448    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
449    |     MONITOR       |    No      | MONITOR                                                                                                             |
450    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
451    |      SAVE         |    No      | SAVE                                                                                                                |
452    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
453    |     SHUTDOWN      |    No      | SHUTDOWN [NOSAVE] [SAVE]                                                                                            |
454    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
455    |     SLAVEOF       |    No      | SLAVEOF host port                                                                                                   |
456    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
457    |     SLOWLOG       |    No      | SLOWLOG subcommand [argument]                                                                                       |
458    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
459    |      SYNC         |    No      | SYNC                                                                                                                |
460    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
461    |      TIME         |    No      | TIME                                                                                                                |
462    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
463    |     COMMAND       |    Yes     | COMMAND                                                                                                     |
464    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
465    |     LOLWUT        |    Yes     | LOLWUT [ argument ...]                                                                                              |
466    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
467
468* COMMAND is forwarded to an arbitrarily chosen redis backend for the benefit of tools such as `redis-cli`.
469  It assumes that all proxied redis servers support the same backend.
470  There is no post-processing; Commands that are not supported by twemproxy are not filtered out.
471* LOLWUT is also forwarded to an arbitrarily chosen redis backend because it does not depend on the state of the database and the presence of the command would not affect production applications.
472  It can be used as a reference for adding future commands with no keys and a variable-length argument list.
473  Other commands such as `TIME` continue to be unsupported. They may vary based on state of the database (e.g. out of sync clocks). Using EVAL with a key known to be on the specific backend server can be done instead.
474
475## Note
476
477- redis commands are not case sensitive
478- only vectored commands 'MGET key [key ...]', 'MSET key value [key value ...]', 'DEL key [key ...]', 'UNLINK key [key ...]', 'EXISTS key [key ...]'  needs to be fragmented
479
480## Performance
481
482### Setup
483
484+ redis-server running on machine A.
485+ nutcracker running on machine A as a local proxy to redis-server.
486+ redis-benchmark running on machine B.
487+ machine A != machine B.
488+ nutcracker built with --enable-debug=no
489+ nutcracker running with mbuf-size of 512 (-m 512)
490+ redis-server built from redis 2.6 branch
491
492### redis-benchmark against redis-server
493
494    $ redis-benchmark -h <machine-A> -q -t set,get,incr,lpush,lpop,sadd,spop,lpush,lrange -c 100 -p 6379
495    SET: 89285.71 requests per second
496    GET: 92592.59 requests per second
497    INCR: 89285.71 requests per second
498    LPUSH: 90090.09 requests per second
499    LPOP: 90090.09 requests per second
500    SADD: 90090.09 requests per second
501    SPOP: 93457.95 requests per second
502    LPUSH (needed to benchmark LRANGE): 89285.71 requests per second
503    LRANGE_100 (first 100 elements): 36496.35 requests per second
504    LRANGE_300 (first 300 elements): 15748.03 requests per second
505    LRANGE_500 (first 450 elements): 11135.86 requests per second
506    LRANGE_600 (first 600 elements): 8650.52 requests per second
507
508### redis-benchmark against nutcracker proxing redis-server
509
510    $ redis-benchmark -h <machine-A> -q -t set,get,incr,lpush,lpop,sadd,spop,lpush,lrange -c 100 -p 22121
511    SET: 85470.09 requests per second
512    GET: 86956.52 requests per second
513    INCR: 85470.09 requests per second
514    LPUSH: 84745.77 requests per second
515    LPOP: 86206.90 requests per second
516    SADD: 84745.77 requests per second
517    SPOP: 86956.52 requests per second
518    LPUSH (needed to benchmark LRANGE): 84745.77 requests per second
519    LRANGE_100 (first 100 elements): 29761.90 requests per second
520    LRANGE_300 (first 300 elements): 12376.24 requests per second
521    LRANGE_500 (first 450 elements): 8605.85 requests per second
522    LRANGE_600 (first 600 elements): 6587.62 requests per second
523
524## redis-auth feature
525
526+ you can enable redis-auth for a pool with 'redis_auth':
527
528        alpha:
529          listen: 127.0.0.1:22121
530          hash: fnv1a_64
531          distribution: ketama
532          redis: true
533          redis_auth: testpass
534
535+ notice:
536    + *MUST* set all redis with a same passwd, and all twemproxy with the same passwd
537    + Length of password should be less than 256
538
539## redis-sentinel feature
540
541+ You can configure sentinel for a pool with 'sentinels' to let twemproxy works with sentinel:
542
543        sigma:
544          listen: 127.0.0.1:22125
545          hash: fnv1a_64
546          distribution: ketama
547          auto_eject_hosts: false
548          redis: true
549          server_retry_timeout: 2000
550          server_failure_limit: 1
551          servers:
552            - 127.0.0.1:6379:1 server1
553            - 127.0.0.1:6380:1 server2
554          sentinels:
555            - 127.0.0.1:26379:1
556            - 127.0.0.1:26380:1
557            - 127.0.0.1:26381:1
558
559+ notice:
560    + You should configure all the sentinels you used. Twemproxy will connect to the alive sentinels when some are down
561    + Weight of sentinel is not used. Twemproxy keeps it because of the server load code reuse
562
563See [sentinel.md](./sentinel.md) for more details.
564