redis aof文件解析成命令
2016-12-29 10:21
501 查看
waoffle
A Redis AOF file parser. This module parses an AOF structure like this:AOF文件解析器。这个模块解析一个AOF结构是这样的:*3 $9 PEXPIREAT $10 myRedisKey $13 1719298712484 *3 $3 SET $9 myJSONKey $24 {"someKey": "someValue"}... into raw Redis commands, like this:生成命令行如下:
PEXPIREAT myRedisKey 1719298712484 SET myJSONKey {"someKey": "someValue"}The opposite can also be achieved by using the reverse binary (
rwaoffle) also provided in this module.相反的也可以通过使用逆向二进制(rwaoffle)也提供了在这个模块。
Installation/Usage
You can install this module vianpm:
$ npm install -g waoffleThis installs a global binary
waoffleto which you can use to pipe your syrup data to:
$ cat appendonly.aof | waoffle # Pipe from other UNIX commands $ waoffle < appendonly.aof # or, pipe directly from stdin $ waoffle appendonly.aof # or, just specify the filenameEach of the three cases above are equivalent. The generated output will be streamed to stdout, to which you can dump into a file using redirection:上面三种情况下是等价的。生成的输出流发送到stdout,你可以转储到一个文件中使用重定向:
$ waoffle < appendonly.aof > generated_commands.txtThe reverse process—going from sets of operations to AOF format—can be achieved in the same manner by substituting calls to
waofflefor
rwaoffle.
Importingdata into Redis
This is useful for importing data directly into a running Redis instance. Simply use therwaofflecommand if you are startingwith a file full of operations. Even though Redis can already read its own AOF file format, this set of tools is even more powerful for filtering your AOF files:这是用于将数据直接导入到运行的复述实例。仅仅使用rwaoffle命令,如果你从一个文件的操作。虽然复述,已经可以读自己的AOF文件格式,这组工具是更强大的过滤AOF文件:
$ waoffle < appendonly.aof | grep SET | rwaoffle # Only grab `SET` operationsUse this in combination with
redis-cli --pipefor maximum win:
$ cat appendonly.aof | redis-cli --pipe # Standard Redis import $ cat commands.txt | rwaoffle | redis-cli --pipe # Importing a list of commands $ cat appendonly.aof | waoffle | grep SET \ | rwaoffle | redis-cli --pipe # Import only `SET` operations
参考:https://github.com/nvite/waoffle
相关文章推荐
- redis的AOF文件格式的解析以及AOF文件的离线优化
- 无法解析外部命令??!!!链接器中的附加依赖项的配置有问题,就是那个啥“.lib”文件
- Redis进阶教程-aof(append only file)日志文件
- Linux文件查找Find命令使用解析
- Redis源码解析(十五)--- aof-append only file解析
- Redis实践之 配置文件解析
- maven 常用命令和配置文件解析
- PCAP 文件内容解析命令
- redis突然掉电导致aof文件损坏修复一例 推荐
- shell查找文件命令解析比较
- redis之字符串命令源码解析(一)
- Redis进阶教程-aof(append only file)日志文件
- ELF格式文件符号表全解析及readelf命令使用方法
- ELF格式文件符号表全解析及readelf命令使用方法
- redis配置文件解析
- ELF格式文件符号表全解析及readelf命令使用方法
- redis 配置文件 append only file(aof)部分---数据持久化
- meteor 命令文件shell 解析
- redis命令解析
- redis之字符串命令源码解析(二)