Difference between revisions of "Timescaledb backup restore"

From UVOO Tech Wiki
Jump to navigation Jump to search
(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...")
 
 
Line 22: Line 22:
  
 
SELECT timescaledb_post_restore();
 
SELECT timescaledb_post_restore();
 +
```
 +
 +
 +
# pg_dump warning
 +
```
 +
pg_dump: warning: there are circular foreign-key constraints on this table:
 +
pg_dump: detail: hypertable
 +
pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.
 +
pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem.
 +
pg_dump: warning: there are circular foreign-key constraints on this table:
 +
pg_dump: detail: chunk
 +
pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.
 +
pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem.
 +
pg_dump: warning: there are circular foreign-key constraints on this table:
 +
pg_dump: detail: continuous_agg
 +
pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.
 +
pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem.
 
```
 
```

Latest revision as of 00:07, 18 February 2024

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();

pg_dump warning

pg_dump: warning: there are circular foreign-key constraints on this table:
pg_dump: detail: hypertable
pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.
pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem.
pg_dump: warning: there are circular foreign-key constraints on this table:
pg_dump: detail: chunk
pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.
pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem.
pg_dump: warning: there are circular foreign-key constraints on this table:
pg_dump: detail: continuous_agg
pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.
pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem.