首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

twemproxy筹建和简介

2013-02-15 
twemproxy搭建和简介To build nutcracker from source with?debug logs enabled?and?assertions disabled:

twemproxy搭建和简介

To build nutcracker from source with?debug logs enabled?and?assertions disabled:

$ git clone git@github.com:twitter/twemproxy.git$ cd twemproxy$ autoreconf -fvi$ ./configure --enable-debug=log$ make$ src/nutcracker -h

我使用的是第一种方法(需要下载他的nutcracker包),原因是服务器基本包缺的太多。

?---------------------------------------

安装完需要配置(我只配置了本地36一台机子,#后边是注释)

?

redis1: #服务器池成员名字

?

? listen: 192.168.6.36:19999 #twemproxy启动端口

?

? hash: fnv1a_64 #具体的hash函数

?

? distribution: ketama #hash算法-如何分布key,关系到均匀分布key的算法,影响命中key等性能,这里是ketama算法

?

? auto_eject_hosts: true #是否在节点无法响应的时候临时找出,区分save data的slave和cache data的slave

?

? redis: true #是否是redis的proxy

?

? server_retry_timeout: 2000 #重试时间ms

?

? server_failure_limit: 1 #节点故障多少次后摘除

?

? servers: # redis节点(ip:端口号:权重)

?

? ?- 192.168.6.36:6379:1

?

-----------------------------------------------

?

?安装配置完成后,可以用nutcracker -t来检查配置文件

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? nutcracker -d后天启动服务

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? nucracker -D和nucracker stat查看代理状态

?

?

------------------------------------------------

?

接下来翻译一下老牛使用nutcracker的心得:

不支持mutiple keys的原因,将这个放在用户设计上,避免从mutiple keys上进行聚合等操作的时间Currently is AFAIK even more strict than Redis Cluster that instead allows MULTI/EXEC blocks if all the commands are about the same key.But IMHO it's the way to go, distribute the subset you can distribute efficiently, and pose this as a design challenge early to the user, instead to invest a big amount of resources into "just works" implementations that try to aggregate data from multiple instances, but that will hardly be fast enough once you start to have serious loads because of too big constant times to move data around.在twemproxy中,一些在redis中如get的命令,如果报错,会一直占有这个链接Twemproxy在errors时,可以监控到error,但是无法做到用其他node代替当前node进行操作,只是发出一个 A SLAVE OF NOONE commond       twemproxy is already able to monitor instance errors, count the number of errors, and eject the node when enough errors are detected. Well it is a shame it is not able to take slave nodes as alternatives, and instead of eject nodes use the alternate nodes just after sending a SLAVE OF NOONE command. This would turn it into an HA solution as well在twemproxy中,对failover失效转化的处理,是用sentinel configuration有规律的更新服务器表2) Or alternatively, I would love if it could be able to work in tandem with Redis Sentinel, checking the Sentinel configuration regularly to upgrade the servers table if a failover happened.还有一种替代的方法,是有一个hot-configure,在失败的时候,可是转化到这个配置文件,进行代理操作proxy ASAP3) Another alternative is to provide a way to hot-configure twemproxy so that on fail overs Sentinel could switch the configuration of the proxy ASAP.

?

?

贴一些我查看的帖子,很有帮助:

http://blog.nosqlfan.com/html/4147.html

http://antirez.com/news/44

https://github.com/twitter/twemproxy/issues?page=1&sort=created&state=open

https://github.com/twitter/twemproxy

?

?一些在此的专业词汇:failover ,?IMHO ,? ASAP , Redis ,?Memcached ,?twemproxy , nutcracker

?

?

?

?

热点排行