Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add pg_dump/restore migration docs #2648

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 0 additions & 189 deletions use-timescale/migration/pg-dump-and-restore.md

This file was deleted.

69 changes: 69 additions & 0 deletions use-timescale/migration/postgres-pg-dump-and-restore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Migrate from Postgres using pg_dump and pg_restore
excerpt: Migrate a entire database with native PostgreSQL commands
products: [cloud, self_hosted]
keywords: [dump, restore]
tags: [recovery, pg_dump, pg_restore]
---

import ConsiderCloud from "versionContent/_partials/_consider-cloud.mdx";

# Migrate to Timescale Cloud using `pg_dump` and `pg_restore`

You can backup and restore an entire database using
the native PostgreSQL [`pg_dump`][pg_dump] and [`pg_restore`][pg_restore]
commands.

## Back up your entire database

You can perform a backup using the `pg_dump` command at the command prompt. For
example, to backup a database named `tsdb`:

```bash
pg_dump -Fc -f tsdb.bak tsdb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are recommending customers to use the flags --no-tablespaces --no-owner --no-privileges to prevent permission errors.

```

To backup a database named `tsdb` hosted on a remote server:

```bash
pg_dump -h <REMOTE_HOST> -p 55555 -U tsdbadmin -Fc -f tsdb.bak tsdb
```

You might see some errors when running `pg_dump`. To learn if they can be safely
ignored, see the [troubleshooting section][troubleshooting].

## Restore your entire database from backup

<Procedure>

### Restoring an entire database from backup

1. Run [timescaledb_pre_restore][timescaledb_pre_restore] to put your database
in the right state for restoring:

```sql
SELECT timescaledb_pre_restore();
```

1. Restore the database:

```sql
\! pg_restore -Fc -d tsdb tsdb.bak

1. Run [`timescaledb_post_restore`][timescaledb_post_restore] to return your
database to normal operations:

```sql
SELECT timescaledb_post_restore();
```

</Procedure>

[parallel importer]: https://github.com/timescale/timescaledb-parallel-copy

Check warning on line 62 in use-timescale/migration/postgres-pg-dump-and-restore.md

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.DeprecatedLinks] This reference might not appear in the main text. Double check and remove it if necessary. Raw Output: {"message": "[Google.DeprecatedLinks] This reference might not appear in the main text. Double check and remove it if necessary.", "location": {"path": "use-timescale/migration/postgres-pg-dump-and-restore.md", "range": {"start": {"line": 62, "column": 1}}}, "severity": "WARNING"}
[pg_dump]: https://www.postgresql.org/docs/current/static/app-pgdump.html
[pg_restore]: https://www.postgresql.org/docs/current/static/app-pgrestore.html
[timescaledb_pre_restore]: /api/:currentVersion:/administration/timescaledb_pre_restore/
[timescaledb_post_restore]: /api/:currentVersion:/administration/timescaledb_post_restore/
[timescaledb-upgrade]: /self-hosted/:currentVersion:/upgrades/

Check warning on line 67 in use-timescale/migration/postgres-pg-dump-and-restore.md

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.DeprecatedLinks] This reference might not appear in the main text. Double check and remove it if necessary. Raw Output: {"message": "[Google.DeprecatedLinks] This reference might not appear in the main text. Double check and remove it if necessary.", "location": {"path": "use-timescale/migration/postgres-pg-dump-and-restore.md", "range": {"start": {"line": 67, "column": 1}}}, "severity": "WARNING"}
[troubleshooting]: /self-hosted/:currentVersion:/troubleshooting/#versions-are-mismatched-when-dumping-and-restoring-a-database
[postgres-docs]: https://www.postgresql.org/docs/current/app-pg-dumpall.html

Check warning on line 69 in use-timescale/migration/postgres-pg-dump-and-restore.md

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.DeprecatedLinks] This reference might not appear in the main text. Double check and remove it if necessary. Raw Output: {"message": "[Google.DeprecatedLinks] This reference might not appear in the main text. Double check and remove it if necessary.", "location": {"path": "use-timescale/migration/postgres-pg-dump-and-restore.md", "range": {"start": {"line": 69, "column": 1}}}, "severity": "WARNING"}
13 changes: 13 additions & 0 deletions use-timescale/migration/timescaledb-pg-dump-and-restore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Migrate from TimescaleDB to Timescale Cloud using pg_dump and pg_restore
excerpt: Migrate a hypertable or entire database with native PostgreSQL commands
products: [cloud, self_hosted]
keywords: [backups, restore]
tags: [recovery, logical backup, pg_dump, pg_restore]
---

import ConsiderCloud from "versionContent/_partials/_consider-cloud.mdx";

# Migration using `pg_dump` and `pg_restore`


12 changes: 9 additions & 3 deletions use-timescale/page-index/page-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,17 @@ module.exports = [
excerpt: "Migrate your existing PostgreSQL database to Timescale",
children: [
{
title: "Migrate with pg_dump and pg_restore",
href: "pg-dump-and-restore",
title: "Migrate from Postgres",
href: "postgres-pg-dump-and-restore",
excerpt:
"Migrate a hypertable or entire database with native PostgreSQL commands",
"Migrate your entire database with native PostgreSQL commands",
},
{
title: "Migrate from TimescaleDB",
href: "timescaledb-pg-dump-and-restore",
excerpt:
"Migrate a hypertable or entire database with native PostgreSQL commands",
}
],
},
{
Expand Down
Loading