CentOS6.10安装redis-dump小插曲
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6.10安装redis-dump小插曲相关的知识,希望对你有一定的参考价值。
前段时间发布过一篇关于redis-dump的安装和简单实用文章
博文地址:http://blog.51cto.com/wujianwei/2105124
昨天因开发同事要求要给另外的一个项目的redis的数据做定时备份,原本想的直接照着之前发布的文档直接部署,但是尝试了几次,总是不成功。于是才有了今天的博文的小插曲,希望能够帮助到遇到同样问题的网友们。接下来让我们一起回顾具体的部署过程:
一、服务器的环境:
[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.10 (Final)
[[email protected] ~]# uname -a
Linux MQ1-S 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
二、安装ruby
1.安装Ruby环境
yum -y install ruby ruby-devel
yum -y install rubygems
2.添加taobao Ruby镜像
添加淘宝ruby源;
[[email protected] ~]# gem sources --add https://ruby.taobao.org/ https://ruby.taobao.org/ added to sources
Error fetching https://ruby.taobao.org/:
hostname was not match with the server certificate (https://gems.ruby-china.com/specs.4.8.gz)
[[email protected] ~]# gem sources --add http://gems.ruby-china.org --remove https://rubygems.org/
Error fetching http://gems.ruby-china.org:
hostname was not match with the server certificate (https://gems.ruby-china.com/specs.4.8.gz)
source https://rubygems.org/ not present in cache
[[email protected] ~]# gem sources -l
*** CURRENT SOURCES ***
http://rubygems.org/
开始报错了,网上各种百度无解。有点小郁闷啊。
于是参照http://blog.51cto.com/wujianwei/2105124 这博文跳过添加淘宝ruby源这一步,继续后面的安装步骤
3.安装curl
yum install curl -y
4.安装rvm管理工具
rvm是一个便捷的多版本ruby环境的管理和切换工具
[[email protected] archives]# curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 24361 100 24361 0 0 6735 0 0:00:03 0:00:03 --:--:-- 13778
Downloading https://github.com/rvm/rvm/archive/1.29.4.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.4/1.29.4.tar.gz.asc
gpg: 于 2018年07月02日 星期一 03时41分26秒 CST 创建的签名,使用 RSA,钥匙号 BF04FF17
gpg: 无法检查签名:No public key
Warning, RVM 1.26.0 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 ‘/usr/local/rvm/archives/rvm-1.29.4.tgz‘ - ‘https://github.com/rvm/rvm/releases/download/1.29.4/1.29.4.tar.gz.asc‘! Try to install GPG v2 and then fetch the public key:
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
the key can be compared with:
https://rvm.io/mpapis.asc
https://keybase.io/mpapis
NOTE: GPG version 2.1.17 have a bug which cause failures during fetching keys from remote server. Please downgrade or upgrade to newer version (if available) or use the second method described above.
安装报错,提示没有public key,于是照着提示,继续下面的操作
[[email protected] archives]# gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
gpg: 钥匙环‘/root/.gnupg/secring.gpg’已建立
gpg: 下载密钥‘D39DC0E3’,从 hkp 服务器 keys.gnupg.net
gpg: /root/.gnupg/trustdb.gpg:建立了信任度数据库
gpg: 密钥 D39DC0E3:公钥“Michal Papis (RVM signing) <[email protected]>”已导入
gpg: 没有找到任何绝对信任的密钥
gpg: 合计被处理的数量:1
gpg: 已导入:1 (RSA: 1)
[[email protected] archives]# curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 24361 100 24361 0 0 8580 0 0:00:02 0:00:02 --:--:-- 36359
Downloading https://github.com/rvm/rvm/archive/1.29.4.tar.gz
curl: (35) SSL connect error
Could not download ‘https://github.com/rvm/rvm/archive/1.29.4.tar.gz‘.
curl returned status ‘35‘.
Downloading https://bitbucket.org/mpapis/rvm/get/1.29.4.tar.gz
Downloading https://bitbucket.org/mpapis/rvm/downloads/1.29.4.tar.gz.asc
gpg: 于 2018年07月02日 星期一 03时41分26秒 CST 创建的签名,使用 RSA,钥匙号 BF04FF17
gpg: 完好的签名,来自于“Michal Papis (RVM signing) <[email protected]>”
gpg: 亦即“Michal Papis <[email protected]>”
gpg: 亦即“[jpeg image of size 5015]”
gpg: 警告:这把密钥未经受信任的签名认证!
gpg: 没有证据表明这个签名属于它所声称的持有者。
主钥指纹: 409B 6B17 96C2 7546 2A17 0311 3804 BB82 D39D C0E3
子钥指纹: 62C9 E5F4 DA30 0D94 AC36 166B E206 C29F BF04 FF17
GPG verified ‘/usr/local/rvm/archives/rvm-1.29.4.tgz‘
Creating group ‘rvm‘
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need to add all users that will be using rvm to ‘rvm‘ group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
* Please do NOT forget to add your users to the rvm group.
The installer no longer auto-adds root or users to the rvm group. Admins must do this.
Also, please note that group memberships are ONLY evaluated at login time.
This means that users must log out then back in before group membership takes effect!
[[email protected] archives]# ll /usr/local/rvm/scripts/rvm
-rwxrwxr-x. 1 root rvm 7615 7月 23 12:20 /usr/local/rvm/scripts/rvm
[[email protected] archives]#
到此处说明ruby环境的管理和切换工具rvm安装成功
加载rvm和列出可安装的 ruby 版本
加载rvm
[[email protected] archives]# source /usr/local/rvm/scripts/rvm
列出可安装的 ruby 版本:
[[email protected] archives]# 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[.10]
[ruby-]2.3[.7]
[ruby-]2.4[.4]
[ruby-]2.5[.1]
[ruby-]2.6[.0-preview2]
ruby-head
#for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2
# JRuby
jruby-1.6[.8]
jruby-1.7[.27]
jruby-9.1[.17.0]
jruby[-9.2.0.0]
jruby-head
# Rubinius
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx-2[.5.8]
rbx-3[.100]
rbx-head
# TruffleRuby
truffleruby[-1.0.0-rc2]
# Opal
opal
# Minimalistic ruby implementation - ISO 30170:2012
mruby-1.0.0
mruby-1.1.0
mruby-1.2.0
mruby-1.3.0
mruby-1[.4.0]
mruby[-head]
# Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2012.02]
# Topaz
topaz
# MagLev
maglev-1.0.0
maglev-1.1[RC1]
maglev[-1.2Alpha4]
maglev-head
# Mac OS X Snow Leopard Or Newer
macruby-0.10
macruby-0.11
macruby[-0.12]
macruby-nightly
macruby-head
# IronRuby
ironruby[-1.1.3]
ironruby-head
[[email protected] archives]#
安装一个ruby版本
#rvm install 2.3.7
[[email protected] archives]# rvm install 2.3.7
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/6/x86_64/ruby-2.3.7.
Continuing with compilation. Please read ‘rvm help mount‘ to get more information on binary rubies.
Checking requirements for centos.
Installing requirements for centos.
Installing required packages: libffi-devel, readline-devel, sqlite-devel......
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.3.7, this may take a while depending on your cpu(s)...
ruby-2.3.7 - #downloading ruby-2.3.7, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
16 13.7M 16 2272k 0 0 1290 0 3:06:19 0:30:02 2:36:17 0
Warning: Transient problem: timeout Will retry in 2 seconds. 3 retries left.
Throwing away 2326528 bytes
100 13.7M 100 13.7M 0 0 2057k 0 0:00:06 0:00:06 --:--:-- 3181k
ruby-2.3.7 - #extracting ruby-2.3.7 to /usr/local/rvm/src/ruby-2.3.7.....
ruby-2.3.7 - #configuring...........................................................
ruby-2.3.7 - #post-configuration..
ruby-2.3.7 - #compiling................................................................................................
ruby-2.3.7 - #installing...........................
ruby-2.3.7 - #making binaries executable..
ruby-2.3.7 - #downloading rubygems-2.7.7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
3 894k 3 31800 0 0 148 0 1:43:08 0:03:33 1:39:35 0
使用一个ruby版本
rvm use 2.3.7
或者如下:
rvm --create ruby-2.3.7
卸载一个已知版本:
rvm remove 2.0.0
查看当前的ruby的版本号:
ruby --version
[[email protected] ~]# ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]
三、安装redis-dump
[[email protected] ~]# gem install redis-dump
Fetching: redis-4.0.1.gem (100%)
Successfully installed redis-4.0.1
Fetching: uri-redis-0.4.2.gem (100%)
Successfully installed uri-redis-0.4.2
Fetching: drydock-0.6.9.gem (100%)
Successfully installed drydock-0.6.9
Fetching: redis-dump-0.4.0.gem (100%)
Successfully installed redis-dump-0.4.0
Parsing documentation for redis-4.0.1
Installing ri documentation for redis-4.0.1
Parsing documentation for uri-redis-0.4.2
Installing ri documentation for uri-redis-0.4.2
Parsing documentation for drydock-0.6.9
Installing ri documentation for drydock-0.6.9
Parsing documentation for redis-dump-0.4.0
Installing ri documentation for redis-dump-0.4.0
Done installing documentation for redis, uri-redis, drydock, redis-dump after 1 seconds
4 gems installed
到此处redis-dump安装完成
以上是关于CentOS6.10安装redis-dump小插曲的主要内容,如果未能解决你的问题,请参考以下文章