Ubuntu 15.10 下Redis Cluster使用
2024-08-22 09:49:38
1 Redis Standalone安装
可以参考这篇博文:http://www.cnblogs.com/_popc/p/3684835.html
2 Redis Cluster安装
2.1 环境介绍:
Ubuntu 15.10,9台电脑,3 master,6 slave
2.2 环境准备:
安装ruby
sudo apt-get install ruby
安装Redis Ruby驱动
sudo gem install redis
2.3 修改配置文件
通用配置文件:redis-common.conf
#GENERAL
daemonize yes
tcp-backlog
timeout
tcp-keepalive
loglevel notice
databases
logfile "/home/hadoop/software/cloud/redis-3.0.4/data/redis/redis.log"
dir /home/hadoop/software/cloud/redis-3.0./working_directory
slave-serve-stale-data yes
#slave只读
slave-read-only yes
#not use default
repl-disable-tcp-nodelay yes
slave-priority
#打开aof持久化
appendonly yes
#每秒一次aof写
appendfsync everysec
#关闭在aof rewrite的时候对新的写操作进行fsync
no-appendfsync-on-rewrite yes
auto-aof-rewrite-min-size 64mb
lua-time-limit
#打开redis集群
cluster-enabled yes
#节点互连超时的阀值
cluster-node-timeout
cluster-migration-barrier
slowlog-log-slower-than
slowlog-max-len
notify-keyspace-events ""
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-entries
list-max-ziplist-value
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit slave 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
aof-rewrite-incremental-fsync yes
个性化配置文件:redis-6379.conf
#包含通用配置
include /home/hadoop/software/cloud/redis-3.0./redis-common.conf
#监听tcp端口
port
#最大可用内存
maxmemory 10240m
#内存耗尽时采用的淘汰策略:
# volatile-lru -> remove the key with an expire set using an LRU algorithm
# allkeys-lru -> remove any key accordingly to the LRU algorithm
# volatile-random -> remove a random key with an expire set
# allkeys-random -> remove a random key, any key
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
# noeviction -> don't expire at all, just return an error on write operations
maxmemory-policy allkeys-lru
#aof存储文件
appendfilename "appendonly-6379.aof"
#rdb文件,只用于动态添加slave过程
dbfilename dump-.rdb
#cluster配置文件(启动自动生成)
cluster-config-file nodes-.conf
#部署在同一机器的redis实例,把auto-aof-rewrite搓开,防止瞬间fork所有redis进程做rewrite,占用大量内存
auto-aof-rewrite-percentage -
2.4 每台机器启动redis-server
redis-server redis-.conf
2.5 创建集群
src/redis-trib.rb create --replicas 192.168.1.100: 192.168.1.101: 192.168.1.106: 192.168.1.107: 192.168.1.108: 192.168.1.109: 192.168.1.103: 192.168.1.104: 192.168.1.105:
2.6 进入Redis命令行测试
redis-cli -c -p
3 Redis Cluster 命令
参考:http://blog.51yip.com/nosql/1726.html
4 参考文献
4.1 http://hot66hot.iteye.com/blog/2050676/
4.2 http://blog.chinaunix.net/uid-7374279-id-4470290.html
最新文章
- 模拟搭建Web项目的真实运行环境(五)
- php下载网络图片到服务器
- (转)__cdecl __fastcall与 __stdcall
- 数据库的Timeout
- REST API (from IBM)
- 结对编程——关于Fault、Error、Failure程序设计
- apache vhost 访问权限配置
- AutoLayout学习之理解intrinsicContentSize,Content Hugging Priority,Content Compression Resistance Priority
- 【Linux命令】--(9)其他常用命令
- 十天学Linux内核之第四天---如何处理输入输出操作
- 警惕Dictionary和SortedDictionary的顺序陷阱
- super 与 this 同时使用问题
- NYOJ 128 前缀表达式的计算
- 【阿里聚安全·安全周刊】双十一背后的“霸下-七层流量清洗”系统| 大疆 VS “白帽子”,到底谁威胁了谁?
- TiDB show processlist命令源码分析
- Idea软件中隐藏忽略.idea,.iml等文件
- luogu P2520 [HAOI2011]向量
- redis-缓存失效三种策略(FIFO 、LRU、LFU)
- Bzoj4763 雪辉
- [redis] linux下主从篇(2)