1.首先声明楼主也是被坑过来的
2.版本信息
a.Redis-4.0.2
b.Twemproxy官网最新版
c.Autoconf-2.6.9
3.安装Twemproxy
1.安装Twemproxy需要autoconf2.6.5以上的版本
a.下载autoconf:wgethttp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
b.解压:tar
zxvf autoconf-2.69.tar.gz
c.进入解压目录:cd
autoconf
d.检测:./configure
坑:在检测的过程中会出现许多的错误,所以楼主建议安装autoconf的时候我们首先安装
M4,automake,liboot
a1.安装M4:
1.下载:wget http://mirrors.kernel.org/gnu/m4/m4-1.4.17.tar.gz
2.解压:tar
-xzvf m4-1.4.13.tar.gz
3.进入解压目录:cd m4-1.4.13
4.检测:./configure
5.安装:make && make install
a2.安装automake:
1.安装:yum
-y install automake
a3.安装liboot:
1.安装:yum
-y install
libtool
e.安装:make && make install
2.安装Twemproxy
a.下载:gitclone
https://github.com/twitter/twemproxy.git
b.检测:CFLAGS="-ggdb3
-O0" autoreconf -fvi && ./configure --prefix=/usr/local/twemproxy --enable-debug=log
c.安装:make && make install
d.进入目录:cd
/usr/local/twemproxy/
e.创建目录:mkdir conf run
f.进入目录:cd
conf
g.创建文件并且编辑:vim
nutcracker.yml
h.添加以下内容:
redis: listen: 0.0.0.0:22122#使用哪个端口启动Twemproxy
hash: fnv1a_64 #key值hash算法,默认fnv1a_64
hash_tag:"{}"
distribution: ketama #分布算法 ketama一致性hash算法;modula非常简 random随机分布
auto_eject_hosts:false#摘除后端故障节点
timeout:400#代理与后端超时时间,毫秒
redis:true#是否是redis缓存,默认是false
server_failure_limit:1#故障多少次摘除
servers:
-127.0.0.1:6380:1 server1
-127.0.0.1:6381:1 server2
-127.0.0.1:6382:1 server3
i.检测配置文件:./nutcracker
-t
注意:这里有一个坑,楼主也是被坑过的,请参考下面的图片: