根据以往的测试结论,单个redis的实例的内存总量最好控制在8G以内(最大不能超过20G),而实际上应用对redis的内存的需求可能会远远大于8G,因此需要一个保持redis server性能不下降,但可以有效扩充redis server的容量的方案。
twemproxy是一个恰当的选择。
简介
twemproxy,也叫nutcraker。是一个twtter开源的一个redis和memcache代理服务器。
特点
• 支持失败节点自动删除
• 支持设置HashTag
• 减少与redis的直接连接数
• 自动分片到后端多个redis实例上
• 避免单点问题
• 可以平行部署多个代理层.client自动选择可用的一个
• 支持redis pipelining request
• 支持状态监控
• 高吞吐量
部署
参考网站:
https://github.com/twitter/twemproxy
核心脚本:
git clone git://github.com/twitter/twemproxy.git
autoreconf -fvi
./configure --prefix=/usr/local --enable-debug=log
make && make install
帮助文档:
Usage: nutcracker [-?hVdDt] [-v verbosity level] [-o output file]
[-c conf file] [-s stats port] [-a stats addr]
[-i stats interval] [-p pid file] [-m mbuf size]
Options:
-h, --help : this help
-V, --version : show version and exit
-t, --test-conf : test configuration for syntax errors and exit
-d, --daemonize : run as a daemon
-D, --describe-stats : print stats description and exit
-v, --verbosity=N : set logging level (default: 5, min: 0, max: 11)
-o, --output=S : set logging file (default: stderr)
-c, --conf-file=S : set configuration file (default: conf/nutcracker.yml)
-s, --stats-port=N : set stats monitoring port (default: 22222)
-a, --stats-addr=S : set stats monitoring ip (default: 0.0.0.0)
-i, --stats-interval=N : set stats aggregation interval in msec (default: 30000 msec)
-p, --pid-file=S : set pid file (default: off)
-m, --mbuf-size=N : set size of mbuf chunk in bytes (default: 16384 bytes)
启动脚本:
./bin/nutcracker -c /usr/local/twemproxy/conf/nutcracker_test.yml -s 22222 -d -o /usr/local/twemproxy/logs/nutcracker.log
依赖包
执行过程中可能遇到依赖包不存在或者版本过低的情况,主要有m4, autoconf, automake, libtool。手动安装过程如下:
安装m4
wget http://mirrors.kernel.org/gnu/m4/m4-1.4.17.tar.gz
tar -xzvf m4-1.4.17.tar.gz
cd m4-1.4.17
./configure --prefix=/usr/local
make && make install
安装autoconf
wget http://mirrors.kernel.org/gnu/autoconf/autoconf-2.69.tar.gz
tar -xzvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/local
make && make install
安装automake
wget http://mirrors.kernel.org/gnu/automake/automake-1.14.tar.gz
tar xzvf automake-1.14.tar.gz
cd automake-1.14
./configure --prefix=/usr/local
make && make install
安装libtool
wget http://mirrors.kernel.org/gnu/libtool/libtool-2.4.tar.gz
tar xzvf libtool-2.4.tar.gz
cd libtool-2.4
./configure --prefix=/usr/local
make && make install
分享到:
相关推荐
Java开发基于SpringBoot+WebSocket+Redis分布式即时通讯群聊系统。一个基于Spring Boot + WebSocket + Redis,可快速开发的分布式即时通讯群聊系统。适用于直播间聊天、游戏内聊天、客服聊天等临时性群聊场景。 ...
毕业设计+Python基于Scrapy+Redis分布式爬虫设计+源码案例+Python + Scrapy + redis 毕业设计+Python基于Scrapy+Redis分布式爬虫设计+源码案例+Python + Scrapy + redis 毕业设计+Python基于Scrapy+Redis分布式爬虫...
SpringBoot基于redis的分布式锁,有word使用文档,根据文档配置即可使用
现在很多项目单机版已经不满足了,分布式变得越受欢迎,同时也带来很多问题,分布式锁也变得没那么容易实现,分享一个redis分布式锁工具类,里面的加锁采用lua脚本(脚本比较简单,采用java代码实现,无须外部调用...
主要介绍了Java基于redis实现分布式锁代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
自己封装redisson方法,同时通过注解的方式加入redis分布式事务锁,可靠。
本资源为一步一步实现redis分布式锁的demo,利用redis实现高可用的分布式锁,规避各种坑、坑、坑!
实现Redis分布式缓存,此文件为相关原理
redis分布式缓存中间件培训PPT
Scrapy-Redis分布式爬虫与搜索网站构建-搜索引擎论文-图书档案学论文.docxScrapy-Redis分布式爬虫与搜索网站构建-搜索引擎论文-图书档案学论文.docxScrapy-Redis分布式爬虫与搜索网站构建-搜索引擎论文-图书档案学...
C++的redis的API、 需要boost库、可直接加入工程目录编译
本篇文章主要介绍了基于 Redis 实现分布式应用限流的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
redis分布式缓存+spring整合及 集群、分片等配置使用例子
redlock-py, 在 python 中,Redis分布式锁 redlock - python 中的分布式锁这个 python 库实现了基于redis的分布式锁管理器算法( ) 。要创建锁定管理器:dlm = Redlock([{"host":"localhost","port":
Redis分布式集群安装配置详细过程步骤
基于redis实现的分布式session控制,多站点 多服务器均可兼容,使用方法:本地启动redis并配置到webconfig中
用注解实现redis分布式锁,防止短时间内重复请求,尤其对于请求耗时较长的方法,希望对大家有帮助
spring session redis分布式session,自定义session解决分布式session不同步问题
redis分布式锁,包含单服务器上锁解锁情况,和分布式上锁解锁情况,全部封装在类里,有需要可以下载,希望可以帮助到你。
Java企业级电商项目架构演进之路 Tomcat集群与Redis分布式,下载绝对值得,里边干活多多