zoukankan      html  css  js  c++  java
  • CentOS 7使用Redis Cluster

    本文更新于2021-11-03,使用Redis 4.0.8,操作系统为CentOS 7.5。

    1. CentOS 7下直接运行redis-trib.rb可能出现如下提示,原因是没有安装Ruby:

      /usr/bin/env: ruby: No such file or directory

    2. 安装Ruby。

      yum install ruby
      
    3. 安装Ruby包管理器。

      yum install rubygems
      
    4. 通过Ruby包管理器安装Redis模块。

      gem install redis
      

      可能出现如下提示,原因是Ruby版本过低:

      ERROR: Error installing redis:
      redis requires Ruby version >= 2.4.0.

    5. 使用RMV(Ruby版本管理器)安装高版本Ruby。

      1. 安装RVM,官方文档见:https://rvm.io/

        curl -sSL https://get.rvm.io | bash -s stable
        

        可能出现如下提示,原因是未安装公钥:

        Warning, RVM 1.29.12 introduces signed releases and automated check of signatures when GPG software found.
        Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).
        GPG signature verification failed for '/home/tigergm/.rvm/archives/rvm-1.29.7.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.7/1.29.7.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:
        gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
        or if it fails:
        command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
        command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
        In case of further problems with validation please refer to https://rvm.io/rvm/security

        根据提示,先运行:

        gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
        

        如失败改为运行:

        curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
        curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
        

        然后再次运行:

        curl -sSL https://get.rvm.io | bash -s stable
        
      2. 使RVM立即生效。

        source /usr/local/rvm/scripts/rvm
        
      3. 查看RVM库中的Ruby版本。

        rvm list known
        
      4. 安装指定版本的Ruby(此处安装2.4.1,可根据需要选择)。

        rvm install 2.4.1
        
      5. 切换Ruby默认版本。

        rvm use 2.4.1 --default
        
      6. 查看Ruby版本。

        ruby --version
        
    6. 重新通过Ruby包管理器安装Redis模块。

      gem install redis
      
    7. 重新运行redis-trib.rb

  • 相关阅读:
    中国用户mac上快速安装nodejs
    移动前端的开发痛点
    前端模块化思考
    tcpdump学习
    curl 同时发送多个请求
    apache 做http代理
    文件 FIFO队列
    mysql多表字段名重复的情况
    时间戳实现增量数据同步
    python 学习
  • 原文地址:https://www.cnblogs.com/garvenc/p/use_redis_cluster_in_centos7.html
Copyright © 2011-2022 走看看