backup-recovery
Production backup strategy and disaster recovery planning for Linux servers, covering database backups, file backups, encryption, cloud storage, retention…
от claude-dev-suite★ 51 звезда на GitHub
Установить backup-recovery в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Backup & Recovery — Production Strategy
The 3-2-1 Rule
Every production backup strategy must satisfy:
- 3 copies of data (1 primary + 2 backups)
- 2 different storage media or locations (e.g., local disk + cloud)
- 1 offsite copy (different geographic region from primary)
| Backup Type | Description | Use Case |
|---|---|---|
| Full | Complete snapshot of all data | Weekly baseline, before major upgrades |
| Incremental | Changes since last backup (any type) | Daily; fast but requires chain for restore |
| Differential | Changes since last full backup | Balances restore speed vs. storage cost |
Recommended schedule: Full weekly + Incremental daily with 30-day retention.
Database Backups
PostgreSQL
# Plain SQL dump (human-readable, compatible with any Postgres version)
pg_dump -U postgres -d mydb > mydb_$(date +%Y%m%d_%H%M%S).sql
# Custom format (-Fc) — compressed, supports parallel restore, preferred for large DBs
pg_dump -U postgres -Fc -d mydb -f mydb_$(date +%Y%m%d_%H%M%S).dump
# Directory format (-Fd) — parallel dump, one file per table
pg_dump -U postgres -Fd -j 4 -d mydb -f mydb_$(date +%Y%m%d_%H%M%S).dir/
# Dump globals (roles, tablespaces) — run separately
pg_dumpall -U postgres --globals-only > globals_$(date +%Y%m%d).sql
# Dump all databases
pg_dumpall -U postgres > all_databases_$(date +%Y%m%d).sql
PostgreSQL restore:
# From plain SQL
psql -U postgres -d mydb < mydb_20241201_030000.sql
# From custom format (parallel restore with -j)
pg_restore -U postgres -d mydb -j 4 --clean --if-exists mydb_20241201_030000.dump
# Create DB first if it doesn't exist
createdb -U postgres mydb
pg_restore -U postgres -d mydb mydb_20241201_030000.dump
# Restore globals first
psql -U postgres < globals_20241201.sql
MongoDB
# Full dump (BSON format)
mongodump --uri="mongodb://user:pass@localhost:27017/mydb" \
--out=/var/backups/mongo/$(date +%Y%m%d_%H%M%S)/
# Compressed archive
mongodump --uri="mongodb://user:pass@localhost:27017/mydb" \
--archive=/var/backups/mongo/mydb_$(date +%Y%m%d).gz \
--gzip
# Restore
mongorestore --uri="mongodb://user:pass@localhost:27017/mydb" \
--drop \
--archive=/var/backups/mongo/mydb_20241201.gz \
--gzip
MySQL / MariaDB
# Single database
mysqldump -u root -p mydb \
--single-transaction \
--routines \
--triggers \
--events \
> mydb_$(date +%Y%m%d_%H%M%S).sql
# All databases
mysqldump -u root -p \
--all-databases \
--single-transaction \
> all_databases_$(date +%Y%m%d).sql
# Restore
mysql -u root -p mydb < mydb_20241201_030000.sql
--single-transaction acquires a consistent snapshot for InnoDB without locking tables.
File Backups with rsync
# Basic archive sync (preserves permissions, timestamps, symlinks)
rsync -av /var/www/html/ /mnt/backup/html/
# With deletion (mirror: remove files deleted from source)
rsync -av --delete /var/www/html/ /mnt/backup/html/
# Exclude paths
rsync -av --delete \
--exclude='*.log' \
--exclude='node_modules/' \
--exclude='.cache/' \
/var/www/ /mnt/backup/www/
# Incremental backup using --link-dest (hardlinks unchanged files — space efficient)
BACKUP_DATE=$(date +%Y%m%d_%H%M%S)
LATEST=/mnt/backup/latest
rsync -av --delete \
--link-dest="$LATEST" \
/var/www/html/ \
/mnt/backup/snapshots/$BACKUP_DATE/
# Update the "latest" symlink
ln -sfn /mnt/backup/snapshots/$BACKUP_DATE /mnt/backup/latest
# Remote sync over SSH (bandwidth-limited to 10 MB/s)
rsync -av --delete \
--bwlimit=10000 \
--partial \
-e "ssh -i /root/.ssh/backup_key -p 22" \
/var/www/html/ \
[email protected]:/backups/html/
rclone for Cloud Storage
Installation and Configuration
curl https://rclone.org/install.sh | sudo bash
# Interactive config
rclone config
# Creates ~/.config/rclone/rclone.conf
~/.config/rclone/rclone.conf:
[b2]
type = b2
account = your-b2-account-id
key = your-b2-application-key
[s3]
type = s3
provider = AWS
access_key_id = AKIAIOSFODNN7EXAMPLE
secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
region = us-east-1
[sftp-backup]
type = sftp
host = backup-server.example.com
user = backup
key_file = /root/.ssh/backup_key
port = 22
rclone Commands
# Copy (source → dest, skip existing identical files)
rclone copy /var/backups/ b2:my-bucket/server-backups/ --progress
# Sync (make destination identical to source — DELETES files not in source)
rclone sync /var/backups/ b2:my-bucket/server-backups/ \
--progress \
--bwlimit 50M
# Copy with bandwidth limit and filtering
rclone copy /var/backups/ s3:my-bucket/backups/ \
--bwlimit 20M \
--include "*.gpg" \
--progress
# List remote contents
rclone ls b2:my-bucket/server-backups/
# Check (verify checksums between source and destination)
rclone check /var/backups/ b2:my-bucket/server-backups/
Encryption with GPG
Neve
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Read - 02
Grep - 03
Glob - 04
Write - 05
Edit - 06
Bash
FAQ
Что делает скилл backup-recovery?
Production backup strategy and disaster recovery planning for Linux servers, covering database backups, file backups, encryption, cloud storage, retention policies, and restore runbooks. USE WHEN: - Designing or implementing a backup strategy for a production server - Writing pg_dump / mongodump / mysqldump backup scripts - Configuring rclone to sync backups to S3, Backblaze B2, or SFTP - Encrypting backup archives with GPG before uploading offsite - Setting up retention schedules (daily/weekly/monthly rotation) - Writing or testing a disaster recovery runbook - Monitoring backup success/failure with healthchecks.io DO NOT USE FOR: - Kubernetes PersistentVolume snapshots (use cloud-provider CSI snapshot tools) - Application-level data export (e.g., Stripe data export, SaaS data portability) - Code repository backups (use git push to multiple remotes) - Windows Server backup (this skill covers Linux only)
Как установить скилл backup-recovery?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл backup-recovery запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…