1 下载编译Reids
wget http://download.redis.io/releases/redis-4.0.1.tar.gz
tar xzf redis-4.0.1.tar.gz
cd redis-4.0.1
make
注意:在执行make的是时候确保包含了编译所需的工具包。阿里云Centos7.0 编译没有问题直接通过
2修改配置文件
port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
说明:nodes.conf就是相当于默认的redis.conf,如果是部署在同一台机器上可以建立如下图所示:
每个文件中的port要不相同对于部署一台机器。
3 启动redis
把redis服务全部以后台启动的方式启动。
注意:设置后台启动
daemonize no
改为
daemonize yes
4 执行gem install redis命令
官方给出的解释是:
The redis-trib utility is in the src directory of the Redis source code distribution. You need to install redis gem to be able to run redis-trib.
gem install redis
(大概意思:redis-trib 工具执行需要安装redis gem才能执行)
5 执行redis-trib.rb命令
然后查看查看控制台打印的运行结果
显示创建集群成功。
6 验证集群正确性
OK 安装完毕验证成功!
安装过程:需要安装ruby