redis集群安装
环境:centos7
单节点安装
下载软件
wget http://download.redis.io/releases/redis-3.2.6.tar.gz
编译安装
tar zxvf redis-3.2.6.tar.gz -C /usr/local/soft/
cd /usr/local/soft/
cd redis-3.2.6/
make && make install
cd /usr/local/soft/
mkdir redis_cluster
cd redis_cluster/
修改配置文件,并启动
安装ruby、rubygem
wget http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.5.tar.gz
tar zxvf ruby-2.3.5.tar.gz
cd ruby-2.3.5
./configure --prefix=/opt/ruby
make && make install
ln -s /opt/ruby/bin/ruby /usr/bin/ruby
ln -s /opt/ruby/bin/gem /usr/bin/gem
安装redis接口
wget http://rubygems.org/downloads/redis-3.3.0.gem
gem install -l redis-3.3.0.gem
查看ruby是否安装成功
./redis-trib.rb
Usage: redis-trib <command> <options> <arguments ...>
rebalance host:port
--threshold <arg>
--simulate
--weight <arg>
--timeout <arg>
--auto-weights
--pipeline <arg>
--use-empty-masters
info host:port
check host:port
fix host:port
。。。
创建集群(注意:先不设置密码,不然会报错can't connect to node)
./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002