KVDR - Key/Value Dump and Restore
Project description
kvdr
Key/Value Dump and Restore (KVDR)
Simple tool to dump and restore data from Key/Value (Redis like) databases.
Requirements
Installation
Quick (Linux)
Assuming you have pip3 already installed (CentOS: yum install python3
installs python3-pip too):
pip3 install --user kvdr
kvdr --help
# or, in the case .local/bin is not in your $PATH:
# .local/bin/kvdr --help
Quick (Linux, Git)
You may want to install a version that has not been published to PyPI. In this case please 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 should be as straightforward. I suggest you try MSYS2. 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 "flushdb\nquit"
# 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 - 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
- Design an API so users can write Dumper/Loader implementations of their own.
Bug reports and feature requests
Please file an issue on GitLab.
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
Built Distribution
File details
Details for the file kvdr-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: kvdr-1.0.4-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 782ea8a7faf829f935736f1761f4eb56d081e9b5a0e52bb61e58a7dd03ee871c |
|
MD5 | c65b6975eb5ffed1e8ebf773285503ae |
|
BLAKE2b-256 | 3642ce636e07be55a212370bb1f2c424da7c67b2ee4bdc85e5b1063ad292bc37 |