设为首页 收藏本站
查看: 1540|回复: 0

[经验分享] Redis3.0.3集群安装

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-8-6 11:30:47 | 显示全部楼层 |阅读模式
一、安装Ruby
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cd /home/redis/software  #把软件下载到/home/redis/software目录下,将应用安装到/home/redis目录下。
wget -r -np -nd --accept=gz --no-check-certificate https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz --http-user=username --http-password=password
tar -zxvf ruby-2.2.2.tar.gz
cd ruby-2.2.2
./configure --profix=/home/redis/ruby
make
make install
vim /etc/profile  #将ruby运行bin目录加到PATH里。在/etc/profile里加入如下内容:
export PATH=/home/redis/ruby/bin:$PATH
source /etc/profile
#由于国内网络原因(你懂的),导致 rubygems.org 存放在 Amazon S3 上面的资源文件间歇性连接失败。所以下面要将https://rubygems.org/改为https://ruby.taobao.org/
gem sources --remove https://rubygems.org/ #移除https://rubygems.org/
gem sources -a https://ruby.taobao.org/    #增加https://ruby.taobao.org/
gem sources -l  #请确保只有 ruby.taobao.org
gem install redis  #安装Ruby的redis接口



二、安装Redis
1
2
3
4
5
cd /home/redis/software  #把软件下载到/home/redis/software目录下,将应用安装到/home/redis目录下。
wget http://download.redis.io/releases/redis-3.0.3.tar.gz
tar -zxvf redis-3.0.3.tar.gz
cd redis-3.0.3
make



三、配置集群
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
cd /home/redis  #把软件下载到/home/redis/software目录下,将应用安装到/home/redis目录下。
mkdir cluster      #创建cluster存放集群软件
cd cluser
mkdir 7000 7001 7002 7003 7004 7005            #创建6个目录,里面分别部署一个redis,三个master,三个slave
cp /home/redis/software/redis.conf ./          #复制一份配置文件
cp /home/redis/software/src/redis-trib.rb ./   #复制集群启动脚本
cp /home/redis/software/src/redis-server ./    #复制redis server
cp /home/redis/software/src/redis-cli ./       #复制redis client
vim redis.conf  #修改如下配置
daemonize yes
port 7000     #把redis.conf分别复制到6个目录后,此处端口值修改为对应的目录名
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
#将redis.conf分别复制到6个目录下并修改port的值为目录名
cp redis.conf 7000
cp redis.conf 7001
cp redis.conf 7002
cp redis.conf 7003
cp redis.conf 7004
cp redis.conf 7005
#分别启动6个redis
cd 7000
../redis-server ./redis.conf
cd ../7001
../redis-server ./redis.conf
cd ../7002
../redis-server ./redis.conf
cd ../7003
../redis-server ./redis.conf
cd ../7004
../redis-server ./redis.conf
cd ../7005
../redis-server ./redis.conf
#创建redis集群
./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 \
127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005

#启动成功后会有如下信息输出:
>>> Creating cluster
Connecting to node 127.0.0.1:7000: OK
Connecting to node 127.0.0.1:7001: OK
Connecting to node 127.0.0.1:7002: OK
Connecting to node 127.0.0.1:7003: OK
Connecting to node 127.0.0.1:7004: OK
Connecting to node 127.0.0.1:7005: OK
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
127.0.0.1:7000
127.0.0.1:7001
127.0.0.1:7002
Adding replica 127.0.0.1:7003 to 127.0.0.1:7000
Adding replica 127.0.0.1:7004 to 127.0.0.1:7001
Adding replica 127.0.0.1:7005 to 127.0.0.1:7002
M: 20aa266add02caae98dc0446259cb5f2e37336f1 127.0.0.1:7000
   slots:0-5460 (5461 slots) master
M: c258baee22bee15698be3c85908a2103c36eb9ce 127.0.0.1:7001
   slots:5461-10922 (5462 slots) master
M: 33e1731b173eb8c47d268c5c681887580e517ef1 127.0.0.1:7002
   slots:10923-16383 (5461 slots) master
S: f74bdac74b19919e9975dbd84db47fcb887f34d4 127.0.0.1:7003
   replicates 20aa266add02caae98dc0446259cb5f2e37336f1
S: 32f7aa6f13ca0d50214b5fcafa50470bbe35edad 127.0.0.1:7004
   replicates c258baee22bee15698be3c85908a2103c36eb9ce
S: ed604701d8c7b85970dbced11541d339614e8338 127.0.0.1:7005
   replicates 33e1731b173eb8c47d268c5c681887580e517ef1
Can I set the above configuration? (type 'yes' to accept): yes   #输入yes即可
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join......
>>> Performing Cluster Check (using node 127.0.0.1:7000)
M: 20aa266add02caae98dc0446259cb5f2e37336f1 127.0.0.1:7000
   slots:0-5460 (5461 slots) master
M: c258baee22bee15698be3c85908a2103c36eb9ce 127.0.0.1:7001
   slots:5461-10922 (5462 slots) master
M: 33e1731b173eb8c47d268c5c681887580e517ef1 127.0.0.1:7002
   slots:10923-16383 (5461 slots) master
M: f74bdac74b19919e9975dbd84db47fcb887f34d4 127.0.0.1:7003
   slots: (0 slots) master
   replicates 20aa266add02caae98dc0446259cb5f2e37336f1
M: 32f7aa6f13ca0d50214b5fcafa50470bbe35edad 127.0.0.1:7004
   slots: (0 slots) master
   replicates c258baee22bee15698be3c85908a2103c36eb9ce
M: ed604701d8c7b85970dbced11541d339614e8338 127.0.0.1:7005
   slots: (0 slots) master
   replicates 33e1731b173eb8c47d268c5c681887580e517ef1
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.






运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-94766-1-1.html 上篇帖子: redis3.0.2集群部署文档 下篇帖子: Redis3 集群功能配置初尝
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表