Skip to main content
Streaming Query Replication (QRep) is a deprecated mirror type and no longer actively maintained. It remains fully functional and no code is currently being removed. We recommend CDC (Change Data Capture) as the actively-maintained mirror type for new mirrors. S3 as a destination is also deprecated.
PeerDB can stream your PostgreSQL data to your S3 bucket in the form of .avro files. Please fill in your AWS credentials in PeerDB’s docker-compose file before running it.

Step 1: CREATE Postgres and S3 Peers

  1. CREATE Postgres PEER. Make sure it satisfies the prerequisites required for our mirror.
  2. CREATE S3 PEER

Step 2: Create and populate tables on the Postgres PEER

Below script helps creates and populate peerdb_demo with 10 rows on your PostgreSQL peer.

Step 3: Kick off Streaming Query Replication

Step 4: Monitor the MIRROR

You can connect to localhost:8085 to gain full visibility into the different jobs and steps that PeerDB performs under the hood to manage the MIRROR.

Step 5: Validate the MIRROR

In a few seconds the MIRROR should complete syncing data. Now validate the data on both postgres and S3 peers. The number of .avro files in the bucket should be equal to the number of partitions (total rows in your source table divided by num_rows_per_partition). In this case, there should be exactly 5 files.

Step 5: DROP MIRROR

To make it easy in your development and test environments, PeerDB also introduces the DROP MIRROR command. DROP MIRROR drops all the underlying objects that CREATE MIRROR generates. More details are available in this PR.