redis 4.0 cluster 环境搭建

Redis Cluster with password Installation on Centos

下载redis 4.0.14

wget http://download.redis.io/releases/redis-4.0.14.tar.gz

解压压缩包并编译

tar -zxvf redis-4.0.14.tar.gz

安装tcl8.5,redis test 需要依赖tcl8.5

yum install -y tcl

编译

cd redis-4.0.14
make && make test
make install

redis cluster 配置

  1. redis cluster 本次安装配置6个node

    mkdir cluster-info
    cd cluster-info
    mkdir 7001 7002 7003 7004 7005
    
  2. 在每个目录下创建redis cluster的config文件 redis.conf,内容如下:

    port 7005
    cluster-enabled yes
    cluster-config-file nodes.conf
    cluster-node-timeout 5000
    appendonly yes
    masterauth password
    requirepass password
    
  3. 用每个目录下的文件启动一个redis的实例,检查输出中有如下信息

    启动命令:nohup redis-server redis.conf &
    输出结果: 
    2376:M 21 Nov 09:43:42.178 * Increased maximum number of open files to 10032 (it was originally set to 1024).
    2376:M 21 Nov 09:43:42.179 * No cluster configuration found, I'm 66b895eba772d8a4c4774038bca93ec237022054
    2376:M 21 Nov 09:43:42.227 * Running mode=cluster, port=7001.
    
  4. 将所有的redis node加入redis cluster中

    安装ruby2.3 使用下面的方法
    gem install redis
    
  5. 修改redis-trib.rb支持密码,该密码需要和node中设置的密码相同

    vim redis-trib.rb 
    @r = Redis.new(:host => @info[:host], :port => @info[:port], :timeout => 60)
    to
    @r = Redis.new(:host => @info[:host], :port => @info[:port], :timeout => 60, :password=>"password")
    
  6. 将所有的redis node添加到cluster中

./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005

centos上安装ruby2.3

yum install centos-release-scl-rh
yum install rh-ruby23  -y
scl  enable  rh-ruby23 bash 
ruby -v
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值