Redis的代理(Twemproxy)

Twemproxy是Twitter开源的Redis代理,借助其可实现稳定的Redis分布式方案,相对于官方较新的Redis Cluster架构,容量伸缩较麻烦。

安装比较简单,注意可能会遇到autoconf版本低的问题。

安装依赖库

# yum install autoconf libtool -y

下载最新版本

https://github.com/twitter/twemproxy/releases

编译安装twemproxy

# tar zxf twemproxy-0.4.1.tar.gz

# cd twemproxy-0.4.1

遇到autoconf版本低的报错

# autoreconf -fvi

...

configure.ac:8: error: Autoconf version 2.64 or higher is required

下载较高版本的autoconf

http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz

编译安装autoconf,并覆盖低版本文件

# ./configure

# make

# make install

# cp /usr/local/bin/autoconf /usr/bin/

# cp /usr/local/bin/autoreconf /usr/bin/

重新安装

# autoreconf -fvi

# ./configure --prefix=/usr/local/twemproxy

# make

# make install

twemproxy的重要特性

1. Maintains persistent server connections.

2. Keeps connection count on the backend caching servers low.

3. Enables pipelining of requests and responses.

4. Supports multiple server pools simultaneously.

5. Observability via stats exposed on the stats monitoring port.

6. Supports multiple hashing modes including consistent hashing and distribution.

配置文件,其中端口6379和6389为2个Redis实例。

$ cat kp.conf

kp:

listen: 127.0.0.1:7379

hash: fnv1a_64

distribution: ketama

timeout: 100

auto_eject_hosts: true

server_retry_timeout: 2000

server_failure_limit: 2

redis: true

redis_auth: abcdefg

servers:

- 127.0.0.1:6379:1

- 127.0.0.1:6389:1

启动twemproxy

$ nutcracker --daemonize --verbose=11 --output=nut.log --conf-file=kp.conf --stats-port=22222 --pid-file=nut.pid

登陆twemproxy

$ redis-cli -p 7379 -a abcdefg

127.0.0.1:7379> get hello

"redis"

127.0.0.1:7379> set twe proxy

OK

127.0.0.1:7379> dbsize

Error: Server closed the connection

获取twemproxy状态

$ curl --get http://127.0.0.1:22222

{"service":"nutcracker", "source":"51", "version":"0.4.1", "uptime":22766,

...

}

若感兴趣可关注订阅号”数据库最佳实践”(DBBestPractice).

原文地址:http://blog.51cto.com/coveringindex/2152799

时间: 2024-08-30 01:56:51

Redis的代理(Twemproxy)的相关文章

Redis 缓存代理 twemproxy

4台 redis 服务器 172.16.1.37:6379   - 1 172.16.1.36:6379   - 2 172.16.1.35:6379   - 3 172.16.1.34:6379   - 4 安装 autoconf centos 7 yum 安装既可, autoconf 版本必须 2.64以上版本 yum -y install autoconf 安装 twemproxy git clone https://github.com/twitter/twemproxy.git aut

轻量的Memcached代理Twemproxy的部署

轻量的Memcached代理Twemproxy的部署 Twemproxy(又称为nutcracker)是一个轻量级的Redis和Memcached代理,主要用来减少对后端缓存服务器的连接数.由Twitter开源出来的缓存服务器集群管理工具,主要用来弥补Redis和Memcached对集群(cluster)管理指出的不足. Twemproxy是一个快速的单线程代理程序,支持Memcached ASCII协议和更新的Redis协议. Twemproxy最了不起的地方就在于它能在节点失败的时候卸载它,

Redis集群Twemproxy

Redis集群Twemproxy 1.环境部署: 操作系统 CentOS 6.4 redis版本 redis-3.0.7 redis主服务器 192.168.1.111 redis从服务器1 192.168.1.112 redis从服务器2 192.168.1.113 有三台服务器,一台COS1安装twemproxy,另外两台COS2,COS3安装redis. 2. Cos1.Cos2和cos3安装redis 见 http://youngcheung.blog.51cto.com/1080901

基于 Redis 的代理 ip 池设计

代理 ip 因为配置简单而且廉价,经常用来作为反反爬虫的手段,但是稳定性一直是其诟病.筛选出优质的代理 ip 并不简单,即使付费购买的代理 ip 源,卖家也不敢保证 100% 可用:另外代理 ip 的生命周期也无法预知,可能上一秒能用,下一秒就扑街了.基于这些原因,会给使用代理 ip 的爬虫程序带来很多不稳定的因素.要排除代理 ip 的影响,通常的做法是建一个代理 ip 池,每次请求前来池子取一个 ip,用完之后归还,保证池子里的 ip 都是可用的.本文接下来就探讨一下,如何使用 Redis 构

高性能的Redis代理TwemProxy

TwemProxy是一个Redis的中间件代理,具有很多有用的功能,可以暂时替代一部分Redis Cluster的功能: 2  支持失败节点自动删除 2  可以设置重新连接该节点的时间 2  可以设置连接多少次之后删除该节点 2  该方式适合作为cache存储 2  支持设置HashTag 2  通过HashTag可以自己设定将两个KEY hash到同一个实例上去. 2  减少与redis的直接连接数 2  保持与redis的长连接 2  可设置代理与后台每个redis连接的数目 2  自动分片

Redis/Memcache代理服务Twemproxy简介

作者:zhanhailiang 日期:2014-12-14 简介 twemproxy,也叫nutcracker,是twtter开源的Redis和Memcache代理服务器. 功能 Fast. Lightweight. Maintains persistent server connections. Keeps connection count on the backend caching servers low. Enables pipelining of requests and respon

缓存代理twemproxy安装测试

twemproxy的安装要求autoconf的版本在2.64以上,需要先安装新版autoconf autoconf安装 wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz tar zxvf autoconf-2.69.tar.gz  cd autoconf-2.69 ./configure  make && make install cd .. twemproxy的安装 git clone https://github.com

为redis安装配置twemproxy

首先,需要下载twemproxy的安装tar包,从https://github.com/twitter/twemproxy 点击页面中的release 可以下载到最新稳定版的源码包. 接下来,在系统上安装  yum install autoconf automake libtool 然后将tar下载好的tar包上传到虚拟机,将tar包解压缩 tar -zxvf twemproxy-0.4.1.tar.gz 进入到解压后的目录,执行 autoreconf -fvi 然后执行 ./configure

redis集群+twemproxy

参考: https://www.zhihu.com/question/21419897 http://www.cnblogs.com/haoxinyue/p/redis.html 为什么集群? 通常,为了提高网站响应速度,总是把热点数据保存在内存中而不是直接从后端数据库中读取.Redis是一个很好的Cache工具.大型网站应用,热点数据量往往巨大,几十G上百G是很正常的事儿,在这种情况下,如何正确架构Redis呢? 首先,无论我们是使用自己的物理主机,还是使用云服务主机,内存资源往往是有限制的,