Centos6.5搭建Redis集群
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos6.5搭建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>
以上是关于Centos6.5搭建Redis集群的主要内容,如果未能解决你的问题,请参考以下文章