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.0.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.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yarb_against_war-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 27c76e19eec27127a93d6aa9fb337ff543d63eeaa5352aca20db72f44cf4144f
MD5 a1bef7e45ffb58657e277be3c05d1ff1
BLAKE2b-256 528bfe9688a0ac2f5551e01f30620c3a87b2bfc4516faca2144a48d5dcfc4052

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yarb_against_war-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4264b84ea9e9ba8543a11a355e13769436df945738845ac8cb4eb502454a6355
MD5 0bb04a3d79c73eb97d1bb8ce25bdf9f8
BLAKE2b-256 6e4ea02bdc2593dd168b396034754f40ff089421ff05e0ca804c3a7513ac2423

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