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

Uploaded Python 3

File details

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

File metadata

  • Download URL: yarb_against_war-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f942f32678f68b4383ce247b9d2e1d18f3ec66dbc1c86b9a685a088b44406e10
MD5 8cdd9deac52c17013386dd70bc4226e9
BLAKE2b-256 079ee48c1f0c43db0353898f80346992e5d9d8194e9a221ab2c7958bbfffe51e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yarb_against_war-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5247425918390e50d9cc22711e0cde393033999655311e03fd565bd02556a759
MD5 8f21411454cbaf5279293f6d81651958
BLAKE2b-256 7d71ff30c255b10816bd5ba29c5678177d165c7ef23f62ab354f764c646baef5

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