源码编译ruby2.6.5
https://ruby-china.org/wiki/ruby-mirror
安装编译依赖工具,gcc、gcc-c++、gdbm-devel、readline-devel和openssl-devel:
yum install gcc gcc-c++ gdbm-devel readline-devel openssl-devel -y
编译安装ruby
cd /usr/local/ruby-2.6.5
./configure --prefix=/usr/local/ruby --enable-shared
make && make install
添加ruby环境变量
vi /etc/profile
export RUBY_HOME=/usr/local/ruby/
export PATH=$RUBY_HOME/bin:$RUBY_HOME/lib:$PATH
source /etc/profile
检查ruby环境配置是否正确
# ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
#redis-dump安装
#vim ~/.gemrc
---
:sources:
- https://gems.ruby-china.com
:ssl_verify_mode: 0
#yum install ruby rubygems ruby-devel -y
#gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
# gem sources -l
*** CURRENT SOURCES ***
http://gems.ruby-china.com/ #确定只剩这一个
# curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 24535 100 24535 0 0 959 0 0:00:25 0:00:25 --:--:-- 644
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
gpg: Signature made Sat 16 Jan 2021 02:46:22 AM CST using RSA key ID 39499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDB
GPG verified '/usr/local/rvm/archives/rvm-1.29.12.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!
Thanks for installing RVM [0m
Please consider donating to our open collective to help us maintain RVM.
Donate: https://opencollective.com/rvm/donate
查找配置文件
# find / -name rvm.sh
/etc/profile.d/rvm.sh
使配置文件生效
# source /etc/profile.d/rvm.sh
# rvm -v
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
#source /usr/local/rvm/scripts/rvm
#gem install redis-dump -V
# redis-dump -v
redis-dump v0.4.0
# redis-load -v
redis-dump v0.4.0
导出数据
#redis-dump --uri=redis://ip1:port --password='xxxxxx'>/tmp/redis.json
备份
关闭目标redis
清空目标redis
# rm appendonly.aof
# rm dump.rdb
开启目标redis
还原数据
cat /tmp/redis.json | redis-load -n --uri=redis://ip2:port --password='xxxxxxxxx'