twemproxy,也叫nutcraker。是一个twtter开源的一个redis和memcache代理服务器。 redis作为一个高效的缓存服务器,非常具有应用价值。但是当使用比较多的时候,就希望可以通过某种方式 统一进行管理。避免每个应用每个客户端管理连接的松散性。同时在一定程度上变得可以控制。 搜索了不少的开源代理项目,知乎实现的python分片客户端。node的代理中间层,还有各种restfull的开源代理。
安装
git clone https://github.com/twitter/twemproxy.git
cd twemproxy/
CFLAGS="-ggdb3 -O0" autoreconf -fvi && ./configure --prefix=/usr/local/twemproxy --enable-debug=log
编译的时候报错
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
configure.ac:8: error: Autoconf version 2.64 or higher is required
configure.ac:8: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: autom4te failed with exit status: 63
autoreconf: aclocal failed with exit status: 63
原因是autoconf版本过低 升级过程点这里
升级之后再次编译安装成功
# /usr/local/twemproxy/sbin/nutcracker -t
nutcracker: configuration file 'conf/nutcracker.yml' syntax is ok
cp conf/nutcracker.yml /usr/local/twemproxy/
启动命令
调试启动
/usr/local/twemproxy/sbin/nutcracker -c /usr/local/twemproxy/nutcracker.yml
以守护进程启动
/usr/local/twemproxy/sbin/nutcracker -d -c /usr/local/twemproxy/nutcracker.yml