Dhirendra Saw
Dhirendra Saw

Reputation: 153

GCP: Full backup of the database in the google cloud platform

I want to perform full backup for the database in the gcp. Suppose if auto backup run at 3:00AM then I want to run manual backup at 3:00PM, so is there any way to do that.

Actually I came to know about exporting the data into the bucket, This is very suitable for me but again the problem is I have to manually export the data to the bucket, so there any way in which data export automatically to the cloud bucket so that I will set life cycle setting of the bucket data to be archived after 30 days.

Thanks,

Upvotes: 1

Views: 1934

Answers (1)

lukaszberwid
lukaszberwid

Reputation: 1177

First of all there are two things backups and exports:

  • Backups remain on the Cloud SQL instance according to retention policies. Cloud SQL backups differ from an export uploaded to Cloud Storage, where you manage the life cycle. Backups encompass the entire database.
  • You export Cloud SQL data to a CSV or SQL dump file in Cloud Storage. You can then import the file into another MySQL database in Cloud SQL. You can also download data from Cloud Storage to your local environment if you want to access it locally.

If you want backups keep in mind that if an on-demand backup is ongoing when an automatic backup is scheduled to begin, the automatic backup is rescheduled for a later time. If you want to run automated backup at 3:00AM you just need to set the time in Manage automated backups tab. Google Cloud SQL retains up to seven automated backups, plus all on-demand backups, for an instance.

If you want automated exports you can take a look at Cloud Scheduler. There is a tutorial showing how to use Cloud Scheduler and Cloud Functions to automatically export a Cloud SQL for MySQL database to Cloud Storage. You can set appropriate retention policy on the bucket to keep the data for 30 days.

Upvotes: 2

Related Questions