notebookvb
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# PostgreSQL Backup - Tower
|
||||
|
||||
PostgreSQL 18 (Docker: `postgresql18`) na Tower (192.168.1.76).
|
||||
|
||||
## Konfigurace
|
||||
|
||||
| Parametr | Hodnota |
|
||||
|----------|---------|
|
||||
| Server | Tower (192.168.1.76) |
|
||||
| Container | `postgresql18` |
|
||||
| Port | 5432 |
|
||||
| User | `vladimir.buzalka` |
|
||||
| Metoda | `pg_dumpall` (všechny DB najednou) |
|
||||
| Záloha | `/mnt/user/Backup/Critical/PostgreSQLBackup/tower/YYYY-MM-DD_HHMM/` |
|
||||
| Retence | 7 dní / posledních 7 záloh |
|
||||
|
||||
## Skripty
|
||||
|
||||
### `postgresqlbackup_with_gzip.sh`
|
||||
Provede `pg_dumpall` všech databází, rolí a tablespaces. Výstup je komprimovaný gzip soubor `all_databases.sql.gz`.
|
||||
|
||||
```bash
|
||||
bash postgresqlbackup_with_gzip.sh
|
||||
```
|
||||
|
||||
Výsledná struktura:
|
||||
```
|
||||
/mnt/user/Backup/Critical/PostgreSQLBackup/tower/
|
||||
└── 2026-05-23_0200/
|
||||
└── all_databases.sql.gz
|
||||
```
|
||||
|
||||
### `postgresqlrestore_from_backup.sh`
|
||||
Obnoví všechny databáze z nejnovější zálohy (nebo ze zadané cesty).
|
||||
|
||||
```bash
|
||||
# Nejnovější záloha (automaticky)
|
||||
bash postgresqlrestore_from_backup.sh
|
||||
|
||||
# Konkrétní záloha
|
||||
bash postgresqlrestore_from_backup.sh /mnt/user/Backup/Critical/PostgreSQLBackup/tower/2026-05-23_0200
|
||||
```
|
||||
|
||||
> **POZOR:** Dump obsahuje `--clean --if-exists`, takže restore přepíše existující data.
|
||||
|
||||
### `verify_backup_integrity.sh`
|
||||
Ověří po restore že jsou všechny DB, tabulky, indexy a role přítomny a funkční.
|
||||
|
||||
```bash
|
||||
bash verify_backup_integrity.sh
|
||||
```
|
||||
|
||||
## Nastavení Unraid User Script
|
||||
|
||||
Na Tower přidat User Script `POSTGRESQL_BACKUP`:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
bash /boot/config/plugins/user.scripts/scripts/POSTGRESQL_BACKUP/postgresqlbackup_with_gzip.sh
|
||||
```
|
||||
|
||||
Schedule: **Daily**
|
||||
|
||||
## Windows přístup k zálohám
|
||||
|
||||
```
|
||||
\\tower\Backup\Critical\PostgreSQLBackup\
|
||||
```
|
||||
Reference in New Issue
Block a user