Google Cloud CloudSQL Cloning - postgresql

I am trying to find more information on GCP CloudSQL Cloning feature but can't find good enough info anywhere or in google docs.
Is this feature similar to zero copy clones which will make instant clones of databases, or it does physical copy of blocks from one instance to create new Cloud SQL instance?
I have 10 TB of postgres database and wondering what's the best way to make a copy of it?
Thanks in advance.

Related

How to back update Postgres database inside K8s cluster

I have setup a postgres database inside the Kubernetes cluster and now I would like to backup the database and don't know how it is possible.
Can anyone help me to get it done ?
Thanks
Sure you can backup your database. You can setup a CronJob to periodically run pg_dump and upload the dumped data into a cloud bucket. Check this blog post for more details.
However, I recommend you to use a Kubernetes native disaster recovery tool like Velero, Stash, Portworx PX-Backup, etc.
If you use an operator to manage your database such as zalando/postgres-operator, CrunchyData, KubeDB, etc. You can use their native database backup functionality.
Disclosure: I am one of the developer of Stash tool.

Compute engine instance move

I have a wordpress site installed on a compute engine instance.
I would like to move it on a new instance with SSD disk and other region as now it runs on standard persistence disk and Google opened new datacenter in my country.
I have upgrated the Ubuntu server to get HTTP/2 support and installed ssl keys for the https support.
Is there a way to move the existing instance with all configuration to new without needing to do it all again?
I read about the disk snapshots but am not sure if it includes everything from the old instance or is it just partial (missing the server update, ssl keys etc)?
It would be great if you guys could help me out because I am a Google cloud noobie with limited technical knowledge.
Thank in advance!
If you're looking to move the compute engine instance to another zone within the same region you can simply just use the gcloud compute instances move command in the Google Cloud shell to move it to a different zone.
Quote from the documentation:
For example, running
gcloud compute instances move example-instance-1 \
--zone us-central1-b --destination-zone us-central1-f
Will move the instance called example-instance-1 with its all attached
persistent disks, currently running in us-central1-b, to
us-central1-f.
References:
https://cloud.google.com/compute/docs/regions-zones/
https://cloud.google.com/sdk/gcloud/reference/compute/instances/move
https://cloud.google.com/compute/docs/instances/moving-instance-across-zones

How to make two node cluster of postgres in google cloud?

I am currently working on google cloud sql. where i have make one single instance of postgres server. i want to build two node postgres cluster with both nodes active.
How can i built it. any help/tutorial or link regarding to it will be highly appreciated.
Thanks
Cloud SQL for Postgres Beta currently does not support any form of High Availability [1].
If this is something you require immediately, you would need to run the nodes yourself or use another solution.
[1] https://cloud.google.com/sql/docs/postgres/high-availability

how we can do automatic backup for compute engine disk everyday ? in google cloud

I have created instance in compute engine with windows server 2012. i cant see any option to take automatic backup for instance disk database everyday. there is option of snapshot but we need to operate this manually. please suggest any way to backup automatically and can be restore able on a single click. if is there any other possibility using cloud SQL storage or any other storage please recommend.
thanks
There's an API to take snapshots, see API section here:
https://cloud.google.com/compute/docs/disks/create-snapshots#create_your_snapshot
You can write a simple app to get triggered from Cron or something to take a snapshot periodically.
You have no provision for automatic back up for compute engine disk. But you can do a manual disk backup by creating a snapshot.
Best alternative way is to create a bucket and move your files there. Google cloud buckets have automated back up facility available.
Cloud storage and cloud SQL are your options for automated back ups in google cloud.

How to replicate MySQL database to Cloud SQL Database

I have read that you can replicate a Cloud SQL database to MySQL. Instead, I want to replicate from a MySQL database (that the business uses to keep inventory) to Cloud SQL so it can have up-to-date inventory levels for use on a web site.
Is it possible to replicate MySQL to Cloud SQL. If so, how do I configure that?
This is something that is not yet possible in CloudSQL.
I'm using DBSync to do it, and working fine.
http://dbconvert.com/mysql.php
The Sync version do the service that you want.
It work well with App Engine and Cloud SQL. You must authorize external conections first.
This is a rather old question, but it might be worth noting that this seems now possible by Configuring External Masters.
The high level steps are:
Create a dump of the data from the master and upload the file to a storage bucket
Create a master instance in CloudSQL
Setup a replica of that instance, using the external master IP, username and password. Also provide the dump file location
Setup additional replicas if needed
VoilĂ !