1 先安装ruby-2.3.1.tar.gz
2 解压 redis-3.2.1.zip 得到redis-3.2.1.gem
3 gem install --local redis-3.2.1.gem -V
4 解压 redis-3.2.0.tar.gz 拷贝到/app/redis/redis-3.2.0
5 安装 make / make install
6 创建集群需要的目录
mkdir /app/redis/redis-nodes
cd /app/redis/redis-nodes
mkdir 7001
mkdir 7002
mkdir 7003
mkdir 7004
mkdir 7005
mkdir 7006
mkdir 7007
mkdir 7008
7 修改配置文件
从/app/redis/redis-3.2.0拷贝redis.conf配置文件的到上述7001~7008文件下并修改配置文件中的下面选项
port 7000
daemonize yes
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
8 ##修改完redis.conf配置文件中的这些配置项之后把这个配置文件分别拷贝到7000/7001/7002/7003/7004/7005目录下面
cp /usr/local/cluster/redis.conf /usr/local/cluster/7000
cp /usr/local/cluster/redis.conf /usr/local/cluster/7001
cp /usr/local/cluster/redis.conf /usr/local/cluster/7002
cp /usr/local/cluster/redis.conf /usr/local/cluster/7003
cp /usr/local/cluster/redis.conf /usr/local/cluster/7004
cp /usr/local/cluster/redis.conf /usr/local/cluster/7005
9 启动集群节点
cd /usr/local/cluster/7001
redis-server redis.conf
cd /usr/local/cluster/7002
redis-server redis.conf
cd /usr/local/cluster/7003
redis-server redis.conf
cd /usr/local/cluster/7004
redis-server redis.conf
cd /usr/local/cluster/7005
redis-server redis.conf
cd /usr/local/cluster/7006
redis-server redis.conf
cd /usr/local/cluster/7007
redis-server redis.conf
cd /usr/local/cluster/7008
redis-server redis.conf
10 ##启动之后使用命令查看redis的启动情况ps -ef|grep redis
11 启动主从复制
cd /app/redis/redis3.2.0/src
./redis-trib.rb create --replicas 1 10.135.6.218:7001 10.135.6.218:7002 10.135.6.218:7003 10.135.6.218:7004 10.135.6.223:7001 10.135.6.223:7002 10.135.6.223:7003 10.135.6.223:7004 10.135.6.225:7001 10.135.6.225:7002 10.135.6.225:7003 10.135.6.225:7004 10.135.6.218:7005 10.135.6.218:7006 10.135.6.218:7007 10.135.6.218:7008 10.135.6.223:7005 10.135.6.223:7006 10.135.6.223:7007 10.135.6.223:7008 10.135.6.225:7005 10.135.6.225:7006 10.135.6.225:7007 10.135.6.225:7008