ubuntu12.04安装ruby2.3
sudo apt-get -y install software-properties-common
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get -y install ruby2.3
reids 从官网下载并安装
tar xvf redis-4.0.2.tar.gz
make && make install
在redis-4.0.2创建对应的集群节点文件夹(每台机器都要创建自己的)
mkdir redis-cluster
mkdir redis-cluster/nodes-1001
mkdir redis-cluster/nodes-1002
复制配置文件到节点文件夹下
cp redis.conf redis-cluster/nodes-1001
cp redis.conf redis-cluster/nodes-1001
#配置文件
port 10002
cluster-enabled yes
bind 192.168.0.161
cluster-config-file nodes-10002.conf
cluster-node-timeout 5000
appendonly yes
安装集群
gem install redis
启动集群之前要启动每台机器节点的Redis
nohup redis-server ./redis-cluster/nodes-10002/redis.conf > 2.log 2>&1 &
启动集群
src/redis-trib.rb create --replicas 1 192.168.0.161:10001 192.168.0.161:10002 192.168.0.162:10003 192.168.0.162:10004 192.168.0.163:10005 192.168.0.163:10006