当前位置: 首页 > 工具软件 > Redis-Dump > 使用案例 >

redis-dump工具安装

孙和安
2023-12-01


实验环境:

主机redis集群安装系统
192.168.19.201redis-cluster 6379、7001、7002redis-3.2.9、rvm、gem、redis-dumpcentos-7.4

由于安装redis-dump工具需要使用rvm 和gem工具所以要提前安装

1.yum安装依赖

[root@localhost ~]# yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools wget curl 

将所需要的依赖安装完成后进行下一步

2 安装rvm

下载密钥

[root@localhost ~]# gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

可能出现一下这种情况

gpgkeys: HTTP fetch error 6: Colud not resolve host: keys.gnupg.net; Name or service not known
gpg: 找不到有效的OpenPGP数据
gpg: 合计被处理的数量:0

可以使用

[root@localhost ~]# curl -sSL https://rvm.io/mapapis.asc | gpg2 --import-
[root@localhost ~]# curl -sSL https://rvm.io/pkkuczynski.asc |gpg2 --import-
或者
[root@localhost ~]# curl -L get.rvm.io | bash -s stable

如果在使用以上方法是出现

curl: (7) Failed connect to raw.githubusercontent.com:443;拒接访问

那么在/etc/hosts中添加一条主机记录

[root@localhost ~]# echo "97.107.133.48 get.Rvm.io" >>/etc/hosts

再次尝试

结尾出现,就是成功
Donate: https://opencillective.com/rvm/donate

检查是否安装成功

[root@localhost ~]# 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/rvm
[root@localhost ~]# source /etc/profile.d/rvm.sh
[root@localhost ~]# rvm requirements
[root@localhost ~]# rvmsudo yum -y install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel

rvm安装完毕!

3.安装ruby

[root@localhost ~]# yum -y install automake autoconf libtool
[root@localhost ~]# yum -y install ruby rubygems ruby-devel
[root@localhost ~]# gem source --add https://gens.ruby-china.com              			#新建gem中国本地源
[root@localhost ~]# gem source -l							#查看gem源
*** CURRENT  SOURCES ***

https://rubygems.org/										#默认的官方源
https://gems-ruby-china.com									#新添加的国内源
[root@localhost ~]# gem source --remove RubtGems.org | your community gem host       			#删除国外官方源
[root@localhost ~]# rvm --version    						 #验证rvm版本
rvm 1.29.12 (latest) by Michal Papis,Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
[root@localhost ~]# ruby --version    						#验证ruby版本
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

这里需要升级一下ruby版本,2.0.0版本无法正常安装redis-dump

[root@localhost ~]# rvm list known			#可以查看rvm支持的安装版本
[root@localhost ~]# rvm install "ruby-2.3.3"           #这里是安装ruby2.3.3这一步很慢,根据网络情况来看
Install of ruby-2.3.3 - #complete
Please be aware that you just installed a ruby that requires 2 patches just to be compiled on an up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to tuby-3.0.0 which which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri
[root@localhost ~]# ruby docs generate-ri  			#这里说ruby3.0.0版本有两个漏洞,需要手动打补丁
[root@localhost ~]# ruby --version				#验证版本是否已更新
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]

4.安装redis-dump

[root@localhost ~]# gem instaall redis-dump
报错:
ERROR: Error installing redis-dump:
       The last version of redis (>=4.0) to support your Ruby & RubyGems was 4.4.0. Try installing it with `gem install redis -v 4.4.0` and then running the current command agagin
       redis requires Ruby version >= 2.4.0. The current ruby version is 2.3.3.222.
[root@localhost ~]# gem install redis -v 4.4.0
Fetching redis-4.4.0.gem
Successfully installed redis-4.4.0
Parsing documentation for redis-4.4.0
Installing ri documentation for redis-4.4.0
Done installing documentation for redis-4.4.0
Done installing documentation for redis after 1 seconds 1 gem installed
[root@localhost ~]# gem instll redis-dump
Building native extensions. This could take a while...
Successfully installed yajl-ruby-1.4.1
Successfully installed redis-dump-0.4.0
Parsing documentation for yajl-tuby-1.4.1
Installing ri documentation for yajl-ruby-1.4.1
Parsing documentation for redis-dump-0.4.0
Installing ri documentation for redis-dump-0.4.0
Done installing documentation for yajl-ruby, redis-dump after 0 seconds 2 gems installed

出现上述结果,即安装成功!

以上就是安装redis-dump的安装方法,如果有什么问题,欢迎大家多多指教

 类似资料: