twemproxy---redis/memcache代理

twemproxy,又名nutcracker,作为一个小巧的redis和memcache的开源代理工具而存在,当某些主机不能直接通信,或者需要把若干redis服务合成一个ip地址来用的时候,它便有了用武之地。

安装也很简单,详细见:https://github.com/twitter/twemproxy

Twemproxy can be configured through a YAML file specified by the -c or --conf-file command-line argument on process start.

配置文件小例:

alpha:
  listen: 127.0.0.1:22121
  hash: fnv1a_64
  distribution: ketama
  auto_eject_hosts: true
  redis: true
  server_retry_timeout: 2000
  server_failure_limit: 1
  servers:
   - 127.0.0.1:6379:1
其中
listen: 127.0.0.1:22121

Use 0.0.0.0 on the listen command to tell twemproxy to listen on all available network interfaces on the server. This mean twemproxy will try to listen on:

  • the loopback address 127.0.0.1 (localhost),
  • on your private IP (i.e. 192.168.0.1) and
  • on your public IP (i.e. 134.xxx.50.34)
最好不要用0.0.0.0,在本地使用就用127.0.0.1,在内网状态使用就用内网地址,在外网使用,就写外网地址。

当使用node_redis连接twemproxy的时候,node_redis默认会向redis服务端发送“info”信息来确认server状态是否是ready,而twemproxy是不支持的,所以要在连接redis的时候添加一个参数no_ready_check: true

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值