码迷,mamicode.com
首页 > 其他好文 > 详细

Centos6.5搭建Redis集群

时间:2016-07-04 19:04:07      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:centos   cluster   redis   

准备6个实例:

10.0.0.12  

10.0.0.13

10.0.0.14

10.0.0.16

10.0.0.18

10.0.0.19

cd /tmp

wget http://download.redis.io/releases/redis-3.2.0.tar.gz

tar -zxvf redis-3.2.0.tar.gz

cd redis-3.2.0/

make PREFIX=/opt/redis-cluster

make PREFIX=/opt/redis-cluster install

mkdir -p /opt/redis-cluster/var

mkdir -p /opt/redis-cluster/etc

rsync -avz /tmp/redis-cluster/src/redis-trib.rb /opt/redis-cluster/bin/

/opt/redis-cluster/bin/redis-trib.rb create --replicas 1 10.0.0.12:7000 10.0.0.13:7000 10.0.0.14:7000 10.0.0.16:7000 10.0.0.18:7000 10.0.0.19:7000

启动脚本,chkconfig --add redis-node;chkconfig redis-node on

 

测试:

/opt/redis-cluster/bin/redis-cli -c -h 10.0.0.12 -p 7000

10.0.0.12:7000> get nmane

-> Redirected to slot [3677] located at 10.0.0.19:7000

(nil)

10.0.0.19:7000> select 1

(error) ERR SELECT is not allowed in cluster mode

10.0.0.19:7000>


附件下载:http://down.51cto.com/data/2226906

Centos6.5搭建Redis集群

标签:centos   cluster   redis   

原文地址:http://ygqygq2.blog.51cto.com/1009869/1795634

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!