HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

pg_rewind — Synchronize a PostgreSQL data directory with another data directory that was forked from it. More in

Submitted by: @import:tldr-pages··
0
Viewed 0 times
directorypg_rewindcommandsynchronizecliwithdatapostgresql

Problem

How to use the pg_rewind command: Synchronize a PostgreSQL data directory with another data directory that was forked from it. More information: <https://www.postgresql.org/docs/current/app-pgrewind.html>.

Solution

pg_rewind — Synchronize a PostgreSQL data directory with another data directory that was forked from it. More information: <https://www.postgresql.org/docs/current/app-pgrewind.html>.

Synchronize target directory with source directory:
pg_rewind {{[-D|--target-pgdata]}} {{path/to/target_data}} --source-pgdata {{path/to/source_data}}


Synchronize target with source server using connection string:
pg_rewind {{[-D|--target-pgdata]}} {{path/to/target_data}} --source-server {{connstr}}


Perform a dry run:
pg_rewind {{[-D|--target-pgdata]}} {{path/to/target_data}} --source-pgdata {{path/to/source_data}} {{[-n|--dry-run]}}


Show progress during synchronization:
pg_rewind {{[-D|--target-pgdata]}} {{path/to/target_data}} --source-pgdata {{path/to/source_data}} {{[-P|--progress]}}


Display help:
pg_rewind {{[-?|--help]}}

Code Snippets

Synchronize target directory with source directory

pg_rewind {{[-D|--target-pgdata]}} {{path/to/target_data}} --source-pgdata {{path/to/source_data}}

Synchronize target with source server using connection string

pg_rewind {{[-D|--target-pgdata]}} {{path/to/target_data}} --source-server {{connstr}}

Perform a dry run

pg_rewind {{[-D|--target-pgdata]}} {{path/to/target_data}} --source-pgdata {{path/to/source_data}} {{[-n|--dry-run]}}

Show progress during synchronization

pg_rewind {{[-D|--target-pgdata]}} {{path/to/target_data}} --source-pgdata {{path/to/source_data}} {{[-P|--progress]}}

Display help

pg_rewind {{[-?|--help]}}

Context

tldr-pages: common/pg_rewind

Revisions (0)

No revisions yet.