1 下载twemproxy(nutcracker)的安装包

wget https://twemproxy.googlecode.com/files/nutcracker-0.3.0.tar.gz

#wget http://42.10.x.x/nutcracker-0.3.0.tar.gz 


2 解压安装
tar -zxvf nutcracker-0.3.0.tar.gz

cd nutcracker-0.3.0 
./configure --prefix=/usr/local/nutcracker
make && make install


3 配置路径

新建配置文件

mkdir -p /usr/local/nutcracker/conf/nutcracker.yml

例子:nutcracker.yml

gamma:
  listen: 10.13.x.x:22121
  hash: md5
  distribution: ketama
  timeout: 100
  backlog: 1024
  preconnect: true
  auto_eject_hosts: true
  server_retry_timeout: 2000
  server_failure_limit: 3
  servers:
   - 10.13.x.x:11211:1
   - 10.13.x.x:11212:1
   - 10.20.x.x:11211:1
   - 10.20.x.x:11212:1


4 启动twemproxy(nutcracker)

/usr/local/nutcracker/sbin/nutcracker -d -c /usr/local/nutcracker/conf/nutcracker.yml

输出日志调试 nutcracker -d -c /usr/local/src/nutcracker-0.3.0/conf/nutcracker.yml --output=log


通过http访问统计

curl "http://172.20.x.x:22121"