Skip to main content

Yet Another Redis Backup utility

Project description

yarb

Yet another Redis backup utility. Partial port of upstash-redis-dump to Python 3.10+.

Dump

pip install -r requirements.txt
export REDIS_URL="rediss://:password1@redis-host.com:12345"
python yarb.py $REDIS_URL my-dump.resp

python yarb.py --help  # for options

Load

From manual:

cat my-dump.resp | redis-cli --pipe

Periodic backup

export REDIS_URL="rediss://:password1@redis-host.com:12345"
python yarb_periodic.py

python yarb_periodic.py --help  # for options

Run as systemd service

See full manual. Example setup:

  1. Create systemd service
sudo nano /etc/systemd/system/yarb.service

Paste something like:

[Unit]
Description=Redis periodic backup
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=my-username
ExecStart=/full/path/to/venv/bin/python /path/to/yarb_periodic.py --workers 10 --backups-dir /path/to/backups/dir

[Install]
WantedBy=multi-user.target
  1. Create .conf configuration to pass environment variable with Redis URL
sudo systemctl edit yarb.service

Paste something like

[Service]
Environment="REDIS_URL=rediss://username:password@redis-host.com:6379"
  1. Start the service and check everything is working
sudo systemctl start yarb.service

# check status
sudo systemctl status yarb.service  

# to view live logs
journalctl -u yarb.service -f  
  1. Enable service so that it is restarted on reboot
sudo systemctl enable yarb.service

Aux scripts

After dumping remote Redis, you can load the dump into local instance and compare it with prod. This script will go through local keys and check corresponding remote values, printing any changes.

REDIS_URL=my-prod-redis:12345 python diff_redis_with_local.py

yarb_periodic.py stores metadata for each backup in a JSON file. To visualize some trends in this metadata, use visualize_metadata.py.

Project details


Download files

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

Source Distribution

yarb_against_war-1.0.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yarb_against_war-1.0.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file yarb_against_war-1.0.2.tar.gz.

File metadata

  • Download URL: yarb_against_war-1.0.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.14

File hashes

Hashes for yarb_against_war-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e18cb0b19854775a21ae105de6e9d8b819ef1480261354726239ac2c342970a4
MD5 a4cbe9f2f34e81a2dcc14abeab0739d7
BLAKE2b-256 5ffe05a9cc310d15946d7ae18365d34f1c57647670e6b9b9899a15d129c7b0cd

See more details on using hashes here.

File details

Details for the file yarb_against_war-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for yarb_against_war-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7f7b49495562b159c832f335ff9f00567c9fdded5f937eb3298941d9fcf08827
MD5 1a69e643edb28b3ba2a990e5778b20f1
BLAKE2b-256 d5cf1fab08ee87e9ed0353b2910448f0c82641b5a57011844933b5b96598da8f

See more details on using hashes here.

Supported by

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