美文网首页
mac twemproxy 教程

mac twemproxy 教程

作者: Wcy100 | 来源:发表于2017-10-25 23:32 被阅读82次

安装及使用

1.安装编译工具

$ brew install autoconf
$ brew install automake
$ brew install libtool

2.下载源码并编译

$ git clone git@github.com:twitter/twemproxy.git
$ cd twemproxy
$ autoreconf -fvi
$ ./configure --enable-debug=full && make

3.创建 memcache proxy 配置文件

vim /data/conf/tw/nutcracker.yml

编辑内容如下:

gamma:
  listen: 127.0.0.1:22123
  hash: fnv1a_64
  distribution: ketama
  timeout: 400
  backlog: 1024
  preconnect: true
  auto_eject_hosts: true
  server_retry_timeout: 2000
  server_failure_limit: 3
  servers:
   - 127.0.0.1:11211:1

4.启动 twemproxy

src/nutcracker -d -c /data/conf/tw/nutcracker.yml

5.检查是否启动成功

ps ax | grep nutcracker

6.连接 twemproxy,测试功能是否正常

telnet 127.0.0.1 22123

此时就可以使用 twemproxy 操作 memcache 了,命令与 memcache 一致。

注意

1.twemproxy 在 set 的时候过期时间不可以为负,否则服务端会主动关闭连接;而memcache 允许 set 命令的过期时间为负,不会主动关闭连接。

相关文章

网友评论

      本文标题:mac twemproxy 教程

      本文链接:https://www.haomeiwen.com/subject/sbgcpxtx.html