Giter Club home page Giter Club logo

rdl's Introduction

rdl - Redis dump-load tool

https://travis-ci.org/reorx/rdl.svg?branch=master

This tool is made specially for dump & load certain database of a redis server, if you want to dump whole redis or replicate from one to another, please checkout redis bgsave or redis replication on google.

NOTE: Package redis is required to use this tool.

Installation

pip install rdl

Usage

usage: rdl [-n N] [-h HOST] [-p PORT] [-a AUTH] [-f] [--ignore-none-value]
           [--help] [--version]
           ACTION FILE

Redis dump-load tool.

positional arguments:
  ACTION                `dump` or `load`.
  FILE                  if action is dump, then its output file, if actions is
                        load, then its source file.

optional arguments:
  -n N                  Number of database to process.
  -h HOST, --host HOST  Redis host
  -p PORT, --port PORT  Redis port
  -a AUTH, --auth AUTH  Redis password
  -f, --flushdb         Force or flush database before load
  --ignore-none-value   Ignore None when dumping db, by default it will raise
                        ValueError if DUMP result is None
  --help                show this help message and exit
  --version             show program's version number and exit

Example

Dump database 1 to file redis.dump:

$ ./rdl.py dump redis.dump -n 1

Load to database 3 from file redis.dump:

$ ./rdl.py load redis.dump -n 3 -f

rdl's People

Contributors

reorx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rdl's Issues

value is None, have error

err message:
Traceback (most recent call last):
File "./rdl.py", line 124, in
main()
File "./rdl.py", line 118, in main
dump(args.file_name, db)
File "./rdl.py", line 66, in dump
line = '%s\t%s\n' % (k, base64.b64encode(v))
File "/usr/lib/python2.7/base64.py", line 53, in b64encode
encoded = binascii.b2a_base64(s)[:-1]
TypeError: must be string or buffer, not None

so maybe if v is None: it should continue

Support TTL and load with EXPIREAT

  • dump

    add option --with-ttl, if used, get TTL and calculate expire time to append to the third column

  • load

    add option --ignore-ttl, if used, third column will be ignored, else EXPIREAT would be called for the key accordingly

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.