Skip to content

epd/waoffle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

waoffle

A Redis AOF file parser. This module parses an AOF structure like this:

*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.

Installation/Usage

You can install this module via npm:

$ npm install -g waoffle

This installs a global binary waoffle to 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 filename

Each 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:

$ waoffle < appendonly.aof > generated_commands.txt

The reverse process—going from sets of operations to AOF format—can be achieved in the same manner by substituting calls to waoffle for rwaoffle.

Importing data into Redis

This is useful for importing data directly into a running Redis instance. Simply use the rwaoffle command if you are starting with 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:

$ waoffle < appendonly.aof | grep SET | rwaoffle    # Only grab `SET` operations

Use this in combination with redis-cli --pipe for 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

About

Redis AOF parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%