Skip to main content

KVDR - Key/Value Dump and Restore

Project description

Copyright (c) 2019, Dejan Lekic All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Download-URL: https://gitlab.com/dejan/kvdr Description: # kvdr

Key/Value Dump and Restore (KVDR)

Simple tool to dump and restore data from Key/Value (Redis like) databases.

# Requirements

# Installation

For the time being (while kvdr is under active development) I am not going to bother to upload to PyPI, so the fastest way to install it is if you do the following:

# Create virtual environment python3 -m venv $HOME/.kvdr # Activate it . $HOME/.kvdr/bin/activate # Install kvdr, version 0.9.8 pip3 install git+https://gitlab.com/dejan/kvdr.git@0.9.8#egg=kvdr

In theory every useful change I made in kvdr is tagged with a new (semantic) version, so it may be that at the time you read this there were some newer releases, so please check the GitLab page.

Installation on Windows/[ReactOS](http://reactos.org) should be as straightforward. I suggest you try [MSYS2](https://www.msys2.org/). In MSYS2, with Python3 packages installed, the installation steps should be the same as above.

# How to use

Use kvdr or kvdr –help to see the list of available options. It should look something like:

KVDR - Key/Value Dump and Restore

Usage:

kvdr dump [–file=<file_name> | –screen] <redis_url> kvdr load (–file=<file_name>) [–dry-run] <redis_url> kvdr –dry-run kvdr (-h | –help) kvdr –version

Options:

-h –help Show this screen. –version Show version. –screen Dump to the console instead of file. –file=<file_name> A file where we store dumped Redis records. Default: “redis.dump” –dry-run A trial run. Works only for the loading operation.

Examples:

kvdr dump –file=redis13.backup redis://admin:BABADEDAuikxWx0oPZYfPE3IXJ9BVlSC@localhost:6379/13 kvdr load –file=redis13.backup redis://:BABADEDAuikxWx0oPZYfPE3IXJ9BVlSC@localhost:6379/3

## Data dump

redis-cli -h localhost -a BABADEDAuikxWx0oPZYfPE3IXJ9BVlSC -n 13 < var/test-data.redis kvdr dump –file=redis-dump.txt redis://admin:BABADEDAuikxWx0oPZYfPE3IXJ9BVlSC@localhost:6379/13

If you have just cloned the kvdr repository, but not installed anything, you can run it inside the working directory:

cd <path to the working directory> python3 -m venv $HOME/.kvdr # Activate it . $HOME/.kvdr/bin/activate PYTHONPATH=. python3 -m kvdr.kvdr dump –file=redis-dump.txt redis://admin:BABADEDAuikxWx0oPZYfPE3IXJ9BVlSC@localhost:6379/13

## Data load

Load the redis.dump file data into the redis://localhost/3 database

# Let’s first delete all the data in the existing database: redis-cli -h localhost -a BABADEDAuikxWx0oPZYfPE3IXJ9BVlSC -n 3 | echo “flushdbnquit” # Load the data kvdr load –file=redis.dump redis://localhost/3

This does not work (yet):

kvdr load –dry-run –file=redis.dump file:///blah.dat

# Credits

[Andy McCurdy](https://github.com/andymccurdy) - for writing fantastic Python library for Redis.

# Future

  • Add support for memcached

  • Add support for DynamoDB

  • Check whether kvdr works out-of-box with [KeyDB](https://keydb.dev/)

  • Design an API so users can write Dumper/Loader implementations of their own.

# Bug reports and feature requests

Please file an [issue on GitLab](https://gitlab.com/dejan/kvdr/issues).

Platform: UNKNOWN Classifier: Programming Language :: Python :: 3 Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Development Status :: 4 - Beta Classifier: Environment :: Console Classifier: Intended Audience :: System Administrators Classifier: Topic :: System :: Recovery Tools Description-Content-Type: text/markdown

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

kvdr-1.0.0-py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page