在執行gem: redis requires Ruby version >= 2.2.2

在執行gem install redis時 : ERROR: Error installing redis: redis requires Ruby version >= 2.2.2

在執行gem install redis時 
提示:html

gem install redis
    ERROR:  Error installing redis:
            redis requires Ruby version >= 2.2.2.

緣由,ruby版本小於了2.2.2。
1.安裝RVM:node

gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
curl -L get.rvm.io | bash -s stable
find / -name rvm -print

/usr/local/rvm 
/usr/local/rvm/src/rvm 
/usr/local/rvm/src/rvm/bin/rvm 
/usr/local/rvm/src/rvm/lib/rvm 
/usr/local/rvm/src/rvm/scripts/rvm 
/usr/local/rvm/bin/rvm 
/usr/local/rvm/lib/rvm 
/usr/local/rvm/scripts/rvmlinux

source /usr/local/rvm/scripts/rvm

2.查看rvm庫中已知的ruby版本redis

rvm list known

MRI Rubies 
[ruby-]1.8.6[-p420] 
[ruby-]1.8.7[-head] # security released on head 
[ruby-]1.9.1[-p431] 
[ruby-]1.9.2[-p330] 
[ruby-]1.9.3[-p551] 
[ruby-]2.0.0[-p648] 
[ruby-]2.1[.10] 
[ruby-]2.2[.6] 
[ruby-]2.3[.3] 
[ruby-]2.4[.0] 
ruby-head 
…. 
3.安裝一個ruby版本ruby

rvm install 2.3.3

No checksum for downloaded archive, recording checksum in user configuration. 
ruby-2.3.3 - #extracting rubygems-2.6.12…. 
ruby-2.3.3 - #removing old rubygems……… 
ruby-2.3.3 - #installing rubygems-2.6.12……………………. 
ruby-2.3.3 - #gemset created /usr/local/rvm/gems/ruby-2.3.3@global 
ruby-2.3.3 - #importing gemset /usr/local/rvm/gemsets/global.gems…………..| 
ruby-2.3.3 - #generating global wrappers…….. 
ruby-2.3.3 - #gemset created /usr/local/rvm/gems/ruby-2.3.3 
ruby-2.3.3 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list 
ruby-2.3.3 - #generating default wrappers…….. 
ruby-2.3.3 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). 
Install of ruby-2.3.3 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri 
4.使用一個ruby版本bash

rvm use 2.3.3

Using /usr/local/rvm/gems/ruby-2.3.3 
[5].設置默認版本app

rvm use 2.3.3 --default

Using /usr/local/rvm/gems/ruby-2.3.3 
[6].卸載一個已知版本curl

rvm remove 2.0.0

查看ruby版本:ui

ruby --version

ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]this

安裝redis:

gem install redis

Fetching: redis-4.0.0.gem (100%) 
Successfully installed redis-4.0.0 
Parsing documentation for redis-4.0.0 
Installing ri documentation for redis-4.0.0 
Done installing documentation for redis after 1 seconds 
1 gem installed

 

 上面的步驟完事了,接下來運行一下redis-trib.rb

複製代碼

技術分享

[root@localhost redisCluster]# ./redis-trib.rb

   Usage: redis-trib <command> <options> <arguments ...>

   reshard        host:port
                  --to <arg>
                  --yes
                  --slots <arg>
                  --from <arg>
  check          host:port
  call            host:port command arg arg .. arg
  set-timeout    host:port milliseconds
  add-node        new_host:new_port existing_host:existing_port
                  --master-id <arg>
                  --slave
  del-node        host:port node_id
  fix            host:port
  import          host:port
                  --from <arg>
  help            (show this help)
  create          host1:port1 ... hostN:portN
                  --replicas <arg>

For check, fix, reshard, del-node, set-timeout you can specify the host and port of any working node in the cluster.

複製代碼

相關文章
相關標籤/搜索