准备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