Giter Site home page Giter Site logo

waoffle's Introduction

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

waoffle's People

Contributors

epd avatar evan-eb avatar philiptang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.