1、 redis水平扩容、集群搭建步骤
(1) mkdir redis-cluster
(2) mkdir 7001 7002 7003 7004 70057006
(3) 将redis安装目录下的redis.conf拷贝到7001,修改redis.conf配置,
bind 私网ip
port 7001
daemonize yes
pidfile /var/run/redis_7001.pid
logfile "/usr/local/redis-cluster/7001/redis.log"
dir /usr/local/redis-cluster/7001/
cluster-enabled yes
cluster-config-file nodes-7001.conf
取消注释 cluster-enabled yes cluster-config-file nodes-7001.conf cluster-node-timeout 15000
appendonly yes
(4) 将此redis.conf拷贝到700*其他目录下将配置700*改为相应目录 :%s/7001/700*
(5) 安装ruby和rubygems
wget https://github.com/rubygems/rubygems/releases/download/v2.2.3/rubygems-2.2.3.tgz
tar xzvfrubygems-2.2.3.tgz
cdrubygems-2.2.3
ruby setup.rb--no-rdoc --no-ri
wgethttps://rubygems.org/downloads/redis-3.2.1.gem
gem installredis-3.2.1.gem --local --no-rdoc --no-ri
(6) 分别启动6个redis实例
(7)cd 到redis解压目录下src目录下
执行./redis-trib.rb create --replicas1 172.18.116.37:7001 172.18.116.37:7002 172.18.116.37:7003 172.18.116.37:7004172.18.116.37:7005 172.18.116.37:7006
测试结果: