Redis 3.0集群搭建/配置/FAQ - RichardParker
来源:互联网 发布:以房养老骗局 知乎 编辑:程序博客网 时间:2024/06/03 20:00
http://www.tuicool.com/articles/3IzyAz6
·声明
1,已官网中文教程为基础,边看边学,结合环境现状搭建。
2,哥对Ruby不热爱、不熟悉、不感冒,所述内容如有疑义请谅解。
3,3.0官说集群还在测试中,其实用用也还算马马虎虎,对外集群API真心少,望有识之士能够出力。
·准备材料
VM9,CentOS 6.4_x86_64(2.6+),SecureCRT,CentOS-6.4-x86_64-bin-DVD1.iso
redis官网:redis-3.0.0-beta1.tar.gz
ruby官网:rubygems-2.0.7.zip
rubygem官网:redis-3.0.7.gem
·下锅
1,把一些基础包装一下,后面会用到
service iptables stop
放入DVD1-
yum install –y gcc*
yum install –y ruby
yum install –y ruby-rdoc
2,装redis
tar -xvf redis-3.0.0-beta1.tar.gz
cd redis-3.0.0-beta
make
make install
ll /usr/local/bin
3,配置集群(假定 $REDIS_HOME=/root/soft/redis,就像ORACLE_HOME一样)
cd $REDIS_HOME
mkdir cluster-test
cd cluster-test
mkdir 7000 7001 7002 7003 7004 7005
vim redis.conf,修改内容如下:
port 7000 个性化
cluster-enabled yescluster-config-file nodes.7000.conf 个性化cluster-node-timeout 5000appendonly yesappendfilename "appendonly.7000.aof" 个性化deamonize yespidfile 个性化log 个性化
cp ../redis.conf ./7000
cp ../redis.conf ./7001
cp ../redis.conf ./7002
cp ../redis.conf ./7003
cp ../redis.conf ./7004
cp ../redis.conf ./7005
cp /usr/local/bin/redis-server ./7000
cp /usr/local/bin/redis-server ./7001
cp /usr/local/bin/redis-server ./7002
cp /usr/local/bin/redis-server ./7003
cp /usr/local/bin/redis-server ./7004
cp /usr/local/bin/redis-server ./7005
/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7000/redis.conf
/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7001/redis.conf
/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7002/redis.conf
/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7003/redis.conf
/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7004/redis.conf
/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7005/redis.conf
如果需要看一看:ps –ef|grep redis
如果需要杀一杀:ps -ef|grep redis|egrep -v grep|awk -F ' ' '{print $2}'|xargs kill -9
4,配置ruby集群脚本
cd /root/soft/rubygems
ruby setup.rb
到redis-3.0.7.gem路径下
gem install -l redis(不用L的话,走ruby官网,95%被WALL,你懂得,自己改source吧)
./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7002 127.0.0.3:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7005(半路记得“yes"一下)
>>> Creating clusterConnecting to node 127.0.0.1:7000: OKConnecting to node 127.0.0.1:7001: OKConnecting to node 127.0.0.1:7002: OKConnecting to node 127.0.0.1:7003: OKConnecting to node 127.0.0.1:7004: OKConnecting to node 127.0.0.1:7005: OK>>> Performing hash slots allocation on 6 nodes...Using 3 masters:127.0.0.1:7000127.0.0.1:7001127.0.0.1:7002127.0.0.1:7000 replica #1 is 127.0.0.1:7003127.0.0.1:7001 replica #1 is 127.0.0.1:7004127.0.0.1:7002 replica #1 is 127.0.0.1:7005M: bc66d90ca24eb6b69a3b375a4e242fef00de2052 127.0.0.1:7000 slots:0-5460 (5461 slots) masterM: bc66d90ca24eb6b69a3b375a4e242fef00de2052 127.0.0.1:7001 slots:5461-10921 (5461 slots) masterM: bc66d90ca24eb6b69a3b375a4e242fef00de2052 127.0.0.1:7002 slots:10922-16383 (5462 slots) masterS: bc66d90ca24eb6b69a3b375a4e242fef00de2052 127.0.0.1:7003 replicates bc66d90ca24eb6b69a3b375a4e242fef00de2052S: bc66d90ca24eb6b69a3b375a4e242fef00de2052 127.0.0.1:7004 replicates bc66d90ca24eb6b69a3b375a4e242fef00de2052S: bc66d90ca24eb6b69a3b375a4e242fef00de2052 127.0.0.1:7005 replicates bc66d90ca24eb6b69a3b375a4e242fef00de2052Can I set the above configuration? (type 'yes' to accept): yes>>> Nodes configuration updated>>> Sending CLUSTER MEET messages to join the clusterWaiting for the cluster to join...>>> Performing Cluster Check (using node 127.0.0.1:7000)M: 75bab28893c3536aecdb9879df97db89b24ce21e 127.0.0.1:7000 slots:5461-10921 (5461 slots) masterM: cfc344721cad8a5ddb7a8d675eb3a4d6e5b9d1c1 127.0.0.1:7002 slots:10922-16383 (5462 slots) masterM: 01b3977a3f592fd1538e8c83f86bbba37d0c1058 127.0.0.3:7003 slots:0-5460 (5461 slots) masterM: df59fce238a1c538933bdc170edb27835d0b7cc7 127.0.0.1:7004 slots: (0 slots) master replicates 01b3977a3f592fd1538e8c83f86bbba37d0c1058M: b6bdb2d309aa7f0b810288f24e975230419f25b1 127.0.0.1:7005 slots: (0 slots) master replicates 75bab28893c3536aecdb9879df97db89b24ce21eM: b6bdb2d309aa7f0b810288f24e975230419f25b1 127.0.0.1:7005 slots: (0 slots) master replicates cfc344721cad8a5ddb7a8d675eb3a4d6e5b9d1c1[OK] All nodes agree about slots configuration.>>> Check for open slots...>>> Check slots coverage...[OK] All 16384 slots covered.
redis-cli -c -p 7000
127.0.0.1:7000> set b c-> Redirected to slot [3300] located at 127.0.0.1:7003OK127.0.0.1:7003> set hello worldOK127.0.0.1:7003> get foo-> Redirected to slot [12182] located at 127.0.0.1:7002(nil)127.0.0.1:7002> get hello-> Redirected to slot [866] located at 127.0.0.1:7003"world"127.0.0.1:7003> get b"c"127.0.0.1:7003>
·FAQ
*** ERROR: Invalid configuration for cluster creation.*** Redis Cluster requires at least 3 master nodes.*** This is not possible with 4 nodes and 1 replicas per node.*** At least 6 nodes are required.
·Redis官说,至少3+3,还延续着Master-Slave的设计理念,这点上个人觉得Cassandra的一致性确实了得。
Either the node already knows other nodes
·因为报错是ruby报的,不太能够理解其意思,因为我之前做了些单机压测,可能直接叠上集群会有垃圾数据,所以把/var/db/和/var/log/下能清空的都清空了。
[13321] 09 Mar 08:09:24.290 # Handshake error: we already know node bc66d90ca24eb6b69a3b375a4e242fef00de2052, updating the address if needed.
·同样道理,ruby报的错,一开始一直在join被我ctrl+c之后开始报错,用上面的方法无果。把所有app目录清空然后redis重装。大家测试时,最后事先vmware快照一下或者redis现网数据备份一下。
·OK,自己爽一下吧
- Redis 3.0集群搭建/配置/FAQ - RichardParker
- Redis 3.0集群搭建/设备/FAQ
- Redis3.0集群搭建/配置/FAQ
- redis-3.0集群搭建
- Redis 3.0集群配置
- redis 集群服务搭建及配置
- Windows 环境下配置搭建Redis集群
- redis配置与cluster集群的搭建
- Redis 集群搭建与一些配置项
- Redis-Cluster集群搭建及配置
- Redis 3.0集群搭建测试(一)
- Redis 3.0集群搭建测试(二)
- Redis 3.0集群搭建测试(一)
- Redis 3.0集群搭建测试(二)
- Redis 3.0 cluster 集群环境搭建
- Redis 3.0集群搭建测试(一)
- Redis 3.0集群搭建测试(二)
- redis集群搭建
- 项目所用技术回顾之excel导入(基于poi)
- sql 中 case when 超炫语法
- SOA、ESB、WebService解释
- ios--时间格式化--NSDateFormatter
- MySQl安装全解
- Redis 3.0集群搭建/配置/FAQ - RichardParker
- Altium 原理图导入PCB
- POJ 1947 树形DP入门题
- Hdu 1010 Tempter of the Bone
- cookie
- The basic C interface in OpenCV for imagine processing
- 设置TextView中的部分位置可以点击,颜色不同
- jquery学习笔记2(W3School学习)
- getPhysicalNumberOfCells 与 getLastCellNum的差异