Timescaledb backup restore

From UVOO Tech Wiki
Revision as of 00:06, 18 February 2024 by Busk (talk | contribs) (Created page with "# Backup & Restore - https://github.com/timescale/timescaledb/issues/1581 - https://docs.timescale.com/migrate/latest/pg-dump-and-restore/pg-dump-restore-from-postgres/ ``` F...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Backup & Restore

Following the guide, it runs OK:

-- BACKUP
-- https://docs.timescale.com/self-hosted/latest/backup-and-restore/pg-dump-and-restore/

pg_dump -h <REMOTE_HOST> -p 55555 -U tsdbadmin -Fc -f tsdb.bak tsdb
-- ATENTION: Do not use the pg_dump command to backup individual hypertables. Dumps created using this method lack the necessary information to correctly restore the hypertable from backup.

-- RESTORE
CREATE DATABASE tsdb;
\c tsdb
CREATE EXTENSION IF NOT EXISTS timescaledb;

SELECT timescaledb_pre_restore();

! pg_restore -Fc -d tsdb tsdb.bak

SELECT timescaledb_post_restore();