Skip to content

nevermatch/redis-cerberus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Redis cluster proxy.

Build

Requirements:

  • UNIX-like system with SO_REUSEPORT | SO_REUSEADDR support
  • epoll support
  • pthread
  • C++ compiler & lib with C++11 features, like g++ 4.8 or clang++ 3.2 (NOTE: install clang++ 3.2 on CentOS 6.5 won't compile because clang uses header files from gcc, which is version 4.4 without C++11 support)
  • Google Test (for test)

To build, just

make

turn on all debug logs

make MODE=debug

or compile with g艹

make COMPILER=g++

To link libstdc++ statically, use

make STATIC_LINK=1

to run test (just cover message parsing parts)

make runtest

run test with valgrind checking

make runtest CHECK_MEM=1

Run

./cerberus example.conf

The argument is path of a configuration file, which should contains at least

  • bind : (integer) local port to listen
  • node : (address) one of active node in a cluster; format should be host:port
  • thread: (integer) number of threads
  • read-slave: (optional, default off) set to "1" to turn on read slave mode. A proxy in read-slave mode won't support writing commands like SET, INCR, PUBLISH, and it would select slave nodes for reading commands if possible. For more information please read here (CN).

Commands in Particular

Restricted Commands Bypass

  • MGET : execute multiple GETs
  • MSET : execute multiple SETs
  • DEL : execute multiple DELs
  • RENAME : if source and destination are not in the same slot, execute a GET-SET-DEL sequence

Extra Commands

  • PROXY / INFO: shows proxy information, including threads count, clients counts, commands statistics
  • KEYSINSLOT slot count: list keys in a specified slot, same as CLUSTER GETKEYSINSLOT slot count
  • UPDATESLOTMAP: notify each thread to update slot map after the next operation
  • SETREMOTES host port host port ...: reset redis server addresses to arguments, and update slot map after that

Not Implemented

  • keys: KEYS, MIGRATE, MOVE, OBJECT, RANDOMKEY, RENAMENX, SCAN, BITOP,
  • list: BLPOP, BRPOP, BRPOPLPUSH, RPOPLPUSH,
  • set: SINTERSTORE, SDIFFSTORE, SINTER, SMOVE, SUNIONSTORE,
  • sorted set: ZINTERSTORE, ZUNIONSTORE,
  • pub/sub: PUBSUB, PUNSUBSCRIBE, UNSUBSCRIBE,

others: PFADD, PFCOUNT, PFMERGE, EVAL, EVALSHA, SCRIPT, WATCH, UNWATCH, EXEC, DISCARD, MULTI, SELECT, QUIT, ECHO, AUTH, CLUSTER, BGREWRITEAOF, BGSAVE, CLIENT, COMMAND, CONFIG, DBSIZE, DEBUG, FLUSHALL, FLUSHDB, LASTSAVE, MONITOR, ROLE, SAVE, SHUTDOWN, SLAVEOF, SLOWLOG, SYNC, TIME,

For more information please read here (CN).

About

Redis Cluster Proxy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.2%
  • Makefile 0.8%