天天看點

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

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>

本文轉自 ygqygq2 51CTO部落格,原文連結:http://blog.51cto.com/ygqygq2/1795634,如需轉載請自行聯系原作者

上一篇: STP基本配置

繼續閱讀