Redis——redis使用redis-dump,redis-load导出导入数据——【三】
来源
https://www.cnblogs.com/dadonggg/p/8662455.html
https://blog.csdn.net/chenxinchongcn/article/details/78666374
安装过程
安装ruby
安装redis-dump之前首先需要安装ruby
$ yum install ruby rubygems ruby-devel -y
报错
安装完成后,安装redis-dump说ruby版本过低,一查才知道原来Redis需要ruby的版本过低,升级版本
[root@izuf63g0jydq42k49eo7zcz ~]# gem install redis-dump
Fetching: yajl-ruby-1.4..gem (%)
Building native extensions. This could take a while...
Successfully installed yajl-ruby-1.4.
Fetching: redis-4.1..gem (%)
ERROR: Error installing redis-dump:
redis requires Ruby version >= 2.2..
安装rvm
利用curl安装rvm,如果没有curl请使用yum安装
$ yum install curl
$ curl -L get.rvm.io | bash -s stable
rvm安装完成后会有两种方式来安装
[root@izuf63g0jydq42k49eo7zcz ~]# curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
--:--:-- --:--:-- --:--:--
:: :: --:--:--
Downloading https://github.com/rvm/rvm/archive/1.29.7.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.7/1.29.7.tar.gz.asc
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: Signature made Fri Jan :: AM CST using RSA key ID 39499BDB
gpg: Can't check signature: No public key
GPG signature verification failed for '/usr/local/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://get.rvm.io | bash -s stable $ source ~/.bashrc $ source ~/.bash_profile $ source /usr/local/rvm/scripts/rvm $ rvm list known #列出版本 $ rvm install 2.5. #选择一个高版本的安装 $ rvm use 2.5. #使用安装的版本 $ ruby --version #不放心,可以查看下版本
安装redis-dump
$ gem install redis-dump
安装完成,查看使用方法
[root@centos_7_6 ~]# redis-dump -h
Try: /usr/local/rvm/gems/ruby-2.5./bin/redis-dump show-commands
Usage: /usr/local/rvm/gems/ruby-2.5./bin/redis-dump [global options] COMMAND [command options]
-u, --uri=S Redis URI (e.g. redis://hostname[:port])
-d, --database=S Redis database (e.g. -d )
-a, --password=S Redis password (e.g. -a 'my@pass/word')
-s, --sleep=S Sleep for S seconds after dumping (for debugging)
-c, --count=S Chunk size (default: )
-f, --filter=S Filter selected keys (passed directly to redis' KEYS command)
-b, --base64 Encode key values as base64 (useful for binary values)
-O, --without_optimizations Disable run time optimizations
-V, --version Display version
-D, --debug
--nosafe [root@centos_7_6 ~]# redis-load
Usage: cat dumpfile_db15.json | redis-load -d
[root@centos_7_6 ~]# redis-load -h
Try: /usr/local/rvm/gems/ruby-2.5./bin/redis-load show-commands
Usage: /usr/local/rvm/gems/ruby-2.5./bin/redis-load [global options] COMMAND [command options]
-u, --uri=S Redis URI (e.g. redis://hostname[:port])
-d, --database=S Redis database (e.g. -d )
-a, --password=S Redis password (e.g. -a 'my@pass/word')
-s, --sleep=S Sleep for S seconds after dumping (for debugging)
-b, --base64 Decode key values from base64 (used with redis-dump -b)
-n, --no_check_utf8
-V, --version Display version
-D, --debug --nosafe
导出
# redis-dump >> /root/redis.json //地址密码
# redis-dump -a123456 -u127.0.0.1:6379 /root/redis.json
导入
cat /root/redis.json | redis-load //有密码使用-a
cat /root/redis.json | redis-load -adatitest1234
Redis——redis使用redis-dump,redis-load导出导入数据——【三】的更多相关文章
- GreenPlum/postgres copy命令导出/导入数据
一.COPY命令简单实用 1.copy在postgres与GreenPlum介绍 1.1 postgrespostgres的COPY命令可以快速的导出/导入数据到postgresql数据库中,支持常用 ...
- Mysql 用命令行导出导入数据方法
方法一: 导出参考:https://www.cnblogs.com/activiti/p/6700044.html 用mysqldump可以导出整个数据库里的表和数据,不单单是只导出某个表的数据 命令 ...
- mysql导出导入数据
使用sql语句导出数据: 导出时如果不写绝对路径,会提示The MySQL server is running with the --secure-file-priv option so it can ...
- Oracle使用expdp/impdp导出导入数据
这里假设已存在数据库用户,并是计划通过该用户导入导出该用户表空间上的数据.(我们这里假定用户名称为ls) 1.创建逻辑目录(数据库命令,sqlplus中执行) Oracle不能直接指定系统目录让他去读 ...
- BCP 导出导入数据(SQL Server)
BCP指令工具可通过安装SQL Server获得. 1. 根据现有的数据库生成表的format文件(导入导出数据的时候需要) bcp db_test.dbo.Table1 format nul -c ...
- 使用BCP导出导入数据
bcp 实用工具可以在 Microsoft SQL Server 实例和用户指定格式的数据文件间大容量复制数据. 使用 bcp 实用工具可以将大量新行导入 SQL Server 表,或将表数据导出到数 ...
- oracle 导出导入数据
在window的运行中输出cmd,然后执行下面的一行代码, imp blmp/blmp@orcl full=y file=D:\blmp.dmp OK,问题解决.如果报找不到该blmp.dmp文件,就 ...
- 【Teradata Utility】使用SQL Assistant导出导入数据
1.导出 (1)选择菜单栏File,点击Export Results,输入导出数据的SQL: select * from etl_data.soure_table; (2)选择导出数据格式为txt或h ...
- [转]使用BCP导出导入数据
本文转自:http://www.cnblogs.com/zerocc/p/3225723.html bcp 实用工具可以在 Microsoft SQL Server 实例和用户指定格式的数据文件间大容 ...
- Oracle导出导入数据
Oracle数据导入导出imp/exp就相当与oracle数据还原与备份, 利用这个功能你可以构建俩个相同的数据库,一个用来测试,一个用来正式使用. 可以在SQLPLUS.EXE或者DOS(命令行)中 ...
随机推荐
- Sql 调优总结
1前言 Sql 语句调优对应用性能非常重要,看了几篇文章,总结了一下数据库优化的方法. 2 数据库 Sql 优化 1 对查询进行优化,要尽量避免全表扫描,首先应考虑在 where 及 order by ...
- 序列化与ArrayList 的elementData的修饰关键字transient
transient用来表示一个域不是该对象序行化的一部分,当一个对象被序行化的时候,transient修饰的变量不会被序列化 ArrayList的动态数组elementData被transient ...
- 配置Nginx虚拟主机
实验环境 一台最小化安装的CentOS 7.3虚拟机 配置基本环境 1. 安装nginx yum install -y epel-* yum isntall -y nginx vim 2. 建立虚机主 ...
- LeetCode 965. Univalued Binary Tree
A binary tree is univalued if every node in the tree has the same value. Return true if and only if ...
- Rimworld单人生存记
开局什么也没有,第一天按原来的墙造了个卧室差不多就完了,可见工作效率之低.花了三四天才种好水稻+草莓,做了短弓,挖了一些钢铁,造了燃料炉灶和屠宰台.第五天来了个人,我用短弓和他打,问题是远程最多打一下 ...
- Windows之PowerShell使用命令
Windows之PowerShell使用命令 切换 命令格式: cd [option] 切换到上一级目录 cd ../ 或者 cd .. 不同磁盘之间切换 盘符: 清屏 清空当前窗口的内容 cls 查 ...
- 学习yii2.0——依赖注入
依赖注入 依赖注入是一种设计模式,可以搜索“php依赖注入”,这里不阐述了. yii框架的依赖注入 Yii 通过 yii\di\Container 类提供 DI 容器特性. 它支持如下几种类型的依赖注 ...
- centos/ubuntu 双击运行 .sh(shell)文件
centos 创建桌面双击启动程序(更改图标) - Feythin Lau - 博客园http://www.cnblogs.com/feiyuliu/archive/2012/11/29/279503 ...
- HTTP之referrer
我们知道,在页面引入图片.JS 等资源,或者从一个页面跳到另一个页面,都会产生新的 HTTP 请求,浏览器一般都会给这些请求头加上表示来源的 Referrer 字段.Referrer 在分析用户来源时 ...
- Setting property 'source' to 'org.eclipse.jst.jee.server:hczm' did not find a matching property