Skip to main content
⚠️ Be aware that a single source and a single target must be provided or the configuration validation will fail.

Yaml

The pgstream configuration can be provided as a yaml configuration file, which encapsulates the transformation configuration. The following sample shows the format for all supported fields.

Environment Variables

Here’s a list of all the environment variables that can be used to configure the individual modules, along with their descriptions and default values.
Byte-size variables (those ending in _BYTES) accept either a plain integer or a human-readable size such as 64MiB or 1GiB. Units are case-insensitive and interpreted as binary multiples (1MiB = 1048576 bytes). The same applies to the equivalent fields in the YAML configuration.

Sources

Postgres Listener

Default: N/A
Required: ✓ Required
Description: URL of the Postgres database to connect to for replication purposes.
Default: “pgstream_dbname_slot”
Required: Optional
Description: Name of the Postgres replication slot name.
Default: False
Required: Optional
Description: Whether to include XIDs in the replication events.
Default: ""
Required: Optional
Description: Comma-separated list of tables to include in the wal2json output. Supports wildcards (e.g. public.*). Filters at the source decode level, preventing wal2json from generating JSON for excluded tables.
Default: ""
Required: Optional
Description: Comma-separated list of tables to exclude from the wal2json output. Supports wildcards (e.g. pipelines.*,private.*). Filters at the source decode level, preventing wal2json from generating JSON for excluded tables.
Default: “full”
Required: Optional
Description: Mode in which the snapshot will be run. It can be one of schema, data or full (both schema and data).
Default: ""
Required: Optional
Description: Tables for which there will be an initial snapshot generated. The syntax supports wildcards. Tables without a schema defined will be applied the public schema. Example: for public.test_table and all tables in the test_schema schema, the value would be the following: "test_table test_schema.\*"
Default: ""
Required: Optional
Description: Tables that will be excluded in the snapshot process. The syntax does not support wildcards. Tables without a schema defined will be applied the public schema.
Default: ""
Required: Optional
Description: Tables for which only the schema will be snapshotted, skipping their data. The syntax supports wildcards. Tables without a schema defined will be applied the public schema. Requires snapshot mode full or schema. Tables explicitly listed in the snapshot tables take precedence over a schema-only wildcard match; excluded tables take precedence over the schema-only list.
Default: 4
Required: Optional
Description: Number of tables per schema that will be processed in parallel by the snapshotting process.
Default: 4
Required: Optional
Description: Number of concurrent workers that will be used per table by the snapshotting process.
Default: 83886080 (80MiB)
Required: Optional
Description: Max batch size in bytes to be read and processed by each table worker at a time. The number of pages in the select queries will be based on this value.
Default: 1
Required: Optional
Description: Number of schemas that will be processed in parallel by the snapshotting process.
Default: 50
Required: Optional
Description: Maximum number of Postgres connections that will be opened by the snapshotting process. This value shouldn’t be lower than the number of schema/table workers selected.
Default: False
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, option to issue commands to DROP all the objects that will be restored. Destructive: the DROPs are applied before the table data is copied, so a snapshot that fails afterwards leaves the target partially rebuilt with the previous contents already gone. See resetting the target.
Default: False
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, option to snapshot all global database objects outside of the selected schema (such as extensions, triggers, etc).
Default: False
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, option to create the database being restored.
Default: False
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, do not output commands to set ownership of objects to match the original database.
Default: False
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, do not output privilege related commands (grant/revoke).
Default: []
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, list of providers whose security labels will be excluded.
Default: False
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, whether to refresh materialized views (REFRESH MATERIALIZED VIEW … WITH DATA) after the table data has been restored.
Default: []
Required: Optional
Description: Space-separated PostgreSQL name=value session settings applied only while restoring indexes and constraints, for example maintenance_work_mem=4GB max_parallel_maintenance_workers=4. Each setting must be a whitespace-free name=value pair; invalid entries fail at startup. Unset or empty preserves existing behavior.
Default: ""
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, role name to be used to create the dump.
Default: “no_passwords”
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, controls how roles are snapshotted. Possible values: “enabled” (snapshot all roles including passwords), “disabled” (do not snapshot roles), “no_passwords” (snapshot roles but exclude passwords).
Default: ""
Required: Optional
Description: When using pg_dump/pg_restore to snapshot schema for Postgres targets, file where the contents of the schema pg_dump command and output will be written for debugging purposes.
Default: ""
Required: Optional
Description: Postgres URL for the database where the snapshot requests and their status will be tracked. A table snapshot_requests will be created under a pgstream schema.
Default: False (run), True (snapshot)
Required: Optional
Description: Allow to repeat snapshots requests that have been already completed successfully. If using the run command, initial snapshots won’t be repeatable by default. If the snapshot command is used instead, the snapshot will be repeatable by default.
Default: False
Required: Optional
Description: Whether to disable progress tracking for the snapshot.
Default: 500ms
Required: Optional
Description: Initial interval for the exponential backoff policy to be applied to the Postgres connection retries.
Default: 10s
Required: Optional
Description: Max interval for the exponential backoff policy to be applied to the Postgres connection retries.
Default: 20
Required: Optional
Description: Max retries for the exponential backoff policy to be applied to the Postgres connection retries.
Default: 0
Required: Optional
Description: Constant interval for the backoff policy to be applied to the Postgres connection retries.
Default: 0
Required: Optional
Description: Max retries for the backoff policy to be applied to the Postgres connection retries.
Default: False
Required: Optional
Description: Disable any retry policy.
One of exponential/constant/disable retries retry policies can be provided for the Postgres connection retry strategy. If none is provided, the exponential defaults apply.

Kafka Listener

Default: N/A
Required: ✓ Required
Description: URLs for the Kafka servers to connect to.
Default: N/A
Required: ✓ Required
Description: Name of the Kafka topic to read from.
Default: N/A
Required: ✓ Required
Description: Name of the Kafka consumer group for the WAL Kafka reader.
Default: Earliest
Required: Optional
Description: Kafka offset from which the consumer will start if there’s no offset available for the consumer group.
Default: False
Required: Optional
Description: Enable TLS connection to the Kafka servers.
Default: ""
Required: Optional
Description: Path to the CA PEM certificate to use for Kafka TLS authentication.
Default: ""
Required: Optional
Description: Path to the client PEM certificate to use for Kafka TLS client authentication.
Default: ""
Required: Optional
Description: Path to the client PEM private key to use for Kafka TLS client authentication.
Default: 0
Required: Optional
Description: Initial interval for the exponential backoff policy to be applied to the Kafka commit retries.
Default: 0
Required: Optional
Description: Max interval for the exponential backoff policy to be applied to the Kafka commit retries.
Default: 0
Required: Optional
Description: Max retries for the exponential backoff policy to be applied to the Kafka commit retries.
Default: 0
Required: Optional
Description: Constant interval for the backoff policy to be applied to the Kafka commit retries.
Default: 0
Required: Optional
Description: Max retries for the backoff policy to be applied to the Kafka commit retries.
Default: False
Required: Optional
Description: Disable any retry policy.
One of exponential/constant backoff policies can be provided for the Kafka committing retry strategy. If none is provided, no retries apply.

Targets

Kafka Batch Writer

Default: N/A
Required: ✓ Required
Description: URLs for the Kafka servers to connect to.
Default: N/A
Required: ✓ Required
Description: Name of the Kafka topic to write to.
Default: 1
Required: Optional
Description: Number of partitions created for the Kafka topic if auto create is enabled.
Default: schema
Required: Optional
Description: Message key strategy for DML events, one of schema, table or primary_key. See the ordering trade-offs below.
Default: 1
Required: Optional
Description: Replication factor used when creating the Kafka topic if auto create is enabled.
Default: False
Required: Optional
Description: Auto creation of configured Kafka topic if it doesn’t exist.
Default: False
Required: Optional
Description: Enable TLS connection to the Kafka servers.
Default: ""
Required: Optional
Description: Path to the CA PEM certificate to use for Kafka TLS authentication.
Default: ""
Required: Optional
Description: Path to the client PEM certificate to use for Kafka TLS client authentication.
Default: ""
Required: Optional
Description: Path to the client PEM private key to use for Kafka TLS client authentication.
Default: 1s
Required: Optional
Description: Max time interval at which the batch sending to Kafka is triggered.
Default: 1572864
Required: Optional
Description: Max size in bytes for a given batch. When this size is reached, the batch is sent to Kafka.
Default: 100
Required: Optional
Description: Max number of messages to be sent per batch. When this size is reached, the batch is sent to Kafka.
Default: False
Required: Optional
Description: Whether to ignore errors encountered while sending batches to the target.
Default: 104857600 (100MiB)
Required: Optional
Description: Max memory used by the Kafka batch writer for inflight batches.
The partition key determines which partition an event is routed to, and therefore which events are consumed in order relative to each other:
  • schema (default): all events for a schema go to the same partition, guaranteeing ordering per schema, including between DDL and DML events. Parallelism is capped at the number of distinct schemas, so extra partitions don’t help a single-schema database.
  • table: events are keyed by schema qualified table name, guaranteeing ordering per table. DDL events remain keyed by schema, so schema changes can be consumed out of order relative to the DML events of the tables they affect.
  • primary_key: events are keyed by schema qualified table name plus the row primary key values, guaranteeing ordering per row and allowing full use of the topic partitions. Requires the injector (PGSTREAM_INJECTOR_STORE_POSTGRES_URL) to identify primary key columns; events without an identifiable primary key fall back to table keying. As with table, DDL events remain keyed by schema and can be consumed out of order relative to DML.

Search Batch Indexer

Default: N/A
Required: ✓ Required
Description: URL for the opensearch store to connect to (at least one of the URLs must be provided).
Default: N/A
Required: ✓ Required
Description: URL for the elasticsearch store to connect to (at least one of the URLs must be provided).
Default: False
Required: Optional
Description: If true, hash document IDs using SHA256 to avoid exceeding the Elasticsearch 512 byte limit.
Default: 1s
Required: Optional
Description: Max time interval at which the batch sending to the search store is triggered.
Default: 100
Required: Optional
Description: Max number of messages to be sent per batch. When this size is reached, the batch is sent to the search store.
Default: False
Required: Optional
Description: Whether to ignore errors encountered while sending batches to the target.
Default: 104857600 (100MiB)
Required: Optional
Description: Max memory used by the search batch indexer for inflight batches.
Default: 1s
Required: Optional
Description: Initial interval for the exponential backoff policy to be applied to the search store operation retries.
Default: 1min
Required: Optional
Description: Max interval for the exponential backoff policy to be applied to the search store operation retries.
Default: 0
Required: Optional
Description: Max retries for the exponential backoff policy to be applied to the search store operation retries.
Default: 0
Required: Optional
Description: Constant interval for the backoff policy to be applied to the search store operation retries.
Default: 0
Required: Optional
Description: Max retries for the backoff policy to be applied to the search store operation retries.
Default: False
Required: Optional
Description: Disable any retry policy.
One of exponential/constant backoff policies can be provided for the search indexer cleanup retry strategy. If none is provided, no retries apply. One of exponential/constant/disable retries backoff policies can be provided for the search store retry strategy. If none is provided, a default exponential backoff policy applies.

Stdout Writer

Default: False
Required: Optional
Description: Set to true to enable the stdout writer target. WAL events are written as NDJSON (one JSON object per line) to stdout.

Webhook Notifier

Default: N/A
Required: ✓ Required
Description: URL for the webhook subscription store to connect to.
Default: False
Required: Optional
Description: Caching applied to the subscription store retrieval queries.
Default: 60s
Required: Optional
Description: Interval at which the subscription store cache will be refreshed. Indicates max cache staleness.
Default: 104857600 (100MiB)
Required: Optional
Description: Max memory used by the webhook notifier for inflight notifications.
Default: 10
Required: Optional
Description: Max number of concurrent workers that will send webhook notifications for a given WAL event.
Default: 10s
Required: Optional
Description: Max time the notifier will wait for a response from a webhook URL before timing out.
Default: “:9900”
Required: Optional
Description: Address for the subscription server to listen on.
Default: 5s
Required: Optional
Description: Max duration for reading an entire server request, including the body before timing out.
Default: 10s
Required: Optional
Description: Max duration before timing out writes of the response. It is reset whenever a new request’s header is read.

Postgres Batch Writer

Default: N/A
Required: ✓ Required
Description: URL for the PostgreSQL store to connect to
Default: 30s
Required: Optional
Description: Max time interval at which the batch sending to PostgreSQL is triggered.
Default: 20000
Required: Optional
Description: Max number of messages to be sent per batch. When this size is reached, the batch is sent to PostgreSQL.
Default: 104857600 (100MiB)
Required: Optional
Description: Max memory used by the postgres batch writer for inflight batches.
Default: 1572864 (1.5MiB), 83886080 (80MiB) with bulk enabled
Required: Optional
Description: Max size in bytes for a given batch. When this size is reached, the batch is sent to PostgreSQL.
Default: False
Required: Optional
Description: Whether to ignore errors encountered while sending events to the target.
Default: False(run), True(snapshot)
Required: Optional
Description: Option to disable triggers on the target PostgreSQL database while performing the snaphot/replication streaming. It defaults to false when using the run command, and to true when using the snapshot command.
Default: error
Required: Optional
Description: Action to apply to inserts on conflict. Options are nothing, update or error.
Default: False
Required: Optional
Description: Whether to stop on non-internal query failures instead of dropping them and continuing. It defaults to false.
Default: False(run), True(snapshot)
Required: Optional
Description: Whether to use COPY FROM on insert only workloads. It defaults to false when using the run command, and to true when using the snapshot command.
Default: 8
Required: Optional
Description: Number of concurrent COPY streams per table when bulk ingesting. Only applies when bulk ingest is enabled.
Default: 500ms
Required: Optional
Description: Initial interval for the exponential backoff policy to be applied to the Postgres connection retries.
Default: 10s
Required: Optional
Description: Max interval for the exponential backoff policy to be applied to the Postgres connection retries.
Default: 20
Required: Optional
Description: Max retries for the exponential backoff policy to be applied to the Postgres connection retries.
Default: 0
Required: Optional
Description: Constant interval for the backoff policy to be applied to the Postgres connection retries.
Default: 0
Required: Optional
Description: Max retries for the backoff policy to be applied to the Postgres connection retries.
Default: False
Required: Optional
Description: Disable any retry policy.
Default: False
Required: Optional
Description: Disable processing of DDL events on the target Postgres database. Consider enabling if source and target roles have different trust levels (see privileges).
Default: False
Required: Optional
Description: Whether to enable auto tuning of batch bytes.
Default: 1048576 (1MB)
Required: Optional
Description: Minimum batch size in bytes used by the auto tune process.
Default: 52428800 (50MB)
Required: Optional
Description: Maximum batch size in bytes used by the auto tune process.
Default: 0.01 (1%)
Required: Optional
Description: Minimum search space width (as a fraction of the max batch bytes) at which the auto tune process stops searching for a better batch size.
One of exponential/constant/disable retries retry policies can be provided for the Postgres connection retry strategy. If none is provided, the exponential defaults apply.

Modifiers

Injector

Default: N/A
Required: ✓ Required
Description: PostgreSQL URL for DDL replication.

Transformer

Default: N/A
Required: Optional
Description: Filepath pointing to the yaml file containing the transformer rules.

Filter

Default: N/A
Required: Optional
Description: List of schema qualified tables for which the WAL events should be processed. If no schema is provided, public schema will be assumed. Wildcards are supported.
Default: N/A
Required: Optional
Description: List of schema qualified tables for which the WAL events should be skipped. If no schema is provided, public schema will be assumed. Wildcards are supported.
Default: N/A
Required: Optional
Description: List of schema qualified tables for which DDL (schema change) events are processed but data (DML) events are skipped. If no schema is provided, public schema will be assumed. Wildcards are supported. Can be combined with either the include or the exclude list.

Sanitizer

Default: false
Required: Optional
Description: Strip null bytes (0x00) from string column values. Useful when the source database contains null bytes that are not allowed by the target.

Instrumentation

Metrics

Default: N/A
Required: Optional
Description: Endpoint where the pgstream metrics will be exported to.
Default: 60s
Required: Optional
Description: Interval at which the pgstream metrics will be collected and exported.

Traces

Default: N/A
Required: Optional
Description: Endpoint where the pgstream traces will be exported to.
Default: 0
Required: Optional
Description: Ratio for the trace sampling. Value must be between 0.0 and 1.0, where 0.0 is no traces sampled, and 1.0 is all traces sampled.

Health endpoint

Exposes /health (liveness, always 200), /ready (readiness, pings the source postgres database when configured), and /status (current pipeline phase: snapshot or replication). Only the run and snapshot commands start the server. Responses are JSON.
Default: False
Required: Optional
Description: Enable the health endpoint server.
Default: localhost:9910
Required: Optional
Description: Address the health server listens on. Use :9910 or 0.0.0.0:9910 to expose externally (e.g. in k8s pods).