I've gotten a case that I need to replicate data from Cloud SQL for PostgreSQL to an external on-premise PostgreSQL DB. I've read the document and found that Cloud SQL for PostgreSQL does not support external replication yet. I've tried to search for a solution on the internet but was unlucky to find one. Does anyone have an idea on how to do this? 3rd party solution is also welcome.
Asked
Active
Viewed 566 times
1 Answers
0
The functionality is indeed not yet supported. Until it is, one workaround would be to schedule exports at regular intervals to a storage solution, and then import the dumps to the on-premise database. Here is how:
1- Create a Cloud Storage bucket into which the export dumps will be stored
2- Create a Cloud Function which will connect to Cloud SQL and coordinate the export operation to the Cloud Storage bucket
3- Use Cloud Scheduler to configure the Cloud Function to trigger at regular intervals
4- Use your desired method for importing the regular dumps to the on-premise database

PYB
- 101
- 1