git地址:
https://github.com/twitter/twemproxy
下载,安装:
![](https://img.haomeiwen.com/i2145947/37b502ce252ab1e3.png)
![](https://img.haomeiwen.com/i2145947/28e0205841fd3fd5.png)
![](https://img.haomeiwen.com/i2145947/96bf2094530e6f4b.png)
配置:
配置文件所在目录:
![](https://img.haomeiwen.com/i2145947/3a02218001e40db9.png)
修改/conf/nutcracker.yml里面的配置参数,即可启动即可。
配置解释:
hash:hash函数
distribution:hashkey的分布式模式
ketama
modula
random
redis_auth: 代理连接hash环中redis服务器的密码
redis:true代表连接的是redis集群
server_connections:与各个redisserver可打开建立的最大连接数
auto_eject_hosts: 是否在节点无法响应时,临时摘除节点
server_retry_timeout:连接redis-server重试时间
server_failure_limit: 当auto_eject_hosts设置为true,redisserver连续几次访问失败,
将会被临时摘除
server_retry_timeout 设置过小的话,将导致我的redis请求经常被指到失败的那个节点上。
tweproxy 根据实验结果 是支持 节点出问题时,自动摘除,恢复后,根据server_retry_timeout恢复的
![](https://img.haomeiwen.com/i2145947/afc01671c1ce7037.png)
配置的详细解释,可见github
启动:
![](https://img.haomeiwen.com/i2145947/15bea545327e0461.png)
![](https://img.haomeiwen.com/i2145947/75dca72b726c25a7.png)
查看帮助:
![](https://img.haomeiwen.com/i2145947/abf0801dc760e07b.png)
tweproxy常见架构:
![](https://img.haomeiwen.com/i2145947/94fb0a2dd4a24273.png)
公司tweproxy配置以及架构:
![](https://img.haomeiwen.com/i2145947/476d3a034ffa7661.png)
![](https://img.haomeiwen.com/i2145947/fbc85abe13a55eef.png)
![](https://img.haomeiwen.com/i2145947/f8603ced431a5847.png)
![](https://img.haomeiwen.com/i2145947/b9a4c2b6af932032.png)
3台62g内存的服务器,每台起3个redis节点,一个tweproxy节点,每台tweproxy节点都hash方式到这三台所有的redis节点上。
公司的启动方式带着监控端口号,监控输出如下:
![](https://img.haomeiwen.com/i2145947/a9a0d377dd6ec19e.png)
另外,tweproxy连接redis实例时,需要注意安全属性的配置,如redis实例中的bind,protected-mode,以及authpassword,如果这三样都没设置,twe则可以直接连接redis实例,如果把protedted-mode设置为false,并设置了密码,那么twe在连接redis实例时,也要设置密码才可连接。
网友评论