Skip to content

Running PGSync

Bootstrap

First, you need to bootstrap the database. This is a one-time operation that:

  • Creates pgsync triggers
  • Creates the logical replication slot
bootstrap --config /path/to/schema.json

Running Modes

There are two modes of running PGSync:

  • Daemon mode - runs continuously
  • Non-daemon mode - runs a single pass and stops
pgsync --config /path/to/schema.json --daemon
pgsync --config /path/to/schema.json

Watch the sync as it runs

Add --monitor to a daemon or WAL run to see events, throughput, slot lag, and errors in a full-screen terminal panel. See Terminal monitor.

Info

You can also specify the schema config as an environment variable SCHEMA and omit it in the commands above. The next section describes how to provide connection parameters via environment variables.