Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

node-redis-dump2

sseide12.4kMIT0.6.0

Backup and restore your Redis data written in node.js.

redis, dump, restore, export, import

readme

Node.js redis dump library

Backup and restore your Redis data written on node.js

This is a fork of the original "node-redis-dump" library from Dmitriy Yurchenko (https://github.com/EvilDevRu/node-redis-dump.git) to get bugfixes and security updates applied.

Installation

  $ npm install node-redis-dump2

Quick Start

The param object given to RedisDump is passed to "ioredis" library to create a new client from. After object initialization an explicit call to connect() must be done.

See examples/ directory for this too.

Parameter for export

Parameter for import

Examples

const RedisDump = require('./node-redis-dump');
let dump = new RedisDump({
    host: 'localhost',
    port: 6379,
    password: ''
});

dump.connect();
dump.export({
    type: 'redis',
    callback: function(err, data) {
        if (err) {
            console.log('Could\'t not make redis dump!', err);
            return;
        }

        console.log('--------- REDIS DUMP ----------');
        console.log(data);
        console.log('--------- /REDIS DUMP ----------');
    }
});

Optional an already existing redis client can be given to the constructor to reuse it.

const RedisDump = require('./node-redis-dump');
const Redis = require('ioredis');

let redis = new Redis({
    host: 'localhost',
    port: 6379,
    password: ''
});
let dump = new RedisDump({client: redis});

dump.export({
    type: 'redis',
    //isCompress: false, (not working now)
    callback: function(err, data) {
        if (err) {
            console.log('Could\'t not make redis dump!', err);
            return;
        }

        console.log('--------- REDIS DUMP ----------');
        console.log(data);
        console.log('--------- /REDIS DUMP ----------');
    }
});

Known Issues

  • does not work with Redis streams (neither export nor import)
  • "redis" type does not work with binary data (neither import into redis nor export from redis)

changelog

CHANGELOG

Version 0.5.0

  • start rewrite code
  • added new import/export type "dump-base64" which uses redis "dump" command. The binary data from the dump are base64 encoded to be able to safe them as string into a file. This allows im/export of complex hashes or strings with line breaks and so similar

Version 0.4.0

  • bump version to have different number as original package (if 0.3.0 might be release there with partial fixes only)

Version 0.3.0

  • forked from original author with some pathes applied
  • switch from redis to ioredis library
  • applied all other patches from Redis-Commander that are missing
  • renamed to node-redis-dump2 and published on npm

Version 0.2.1

latest released version from original author (node-redis-dump)