Cloud SQL
- Create and Manage Replications
- We create replicas of the database to increase availability
- First kind of Replication is Read Replicas
Cloud SQL Read Replicas and other replicas
- They are low cost availability replicas for the primary/master instance.
- Lets create an Cloud SQL instance
- with private ip connected to some vnet

- with private ip connected to some vnet
- Create a vm instance in the same vnet where you configured private connectivity

- Lets install a sample database Refer Here

- Lets create a read replica

- After the read replication is created we can promote read replication to make this replica a primary or a standby instance which allows create, retrieve, update and delete statements

- Disable replication will remove the replication b/w instances
- To create a failover click on failover on the cloud sql instance in the overview page
- External replication is done by executing mysql native options Refer Here
Connectivity to cloud sql instances
- To understand private connectivity, as we have already mentioned vms in a particular network where the private service endpoint is created can communicate to the database over private ip address

- Refer Here for the official documentation about connecting to database instances

Cloud Spanner
- Cloud spanner is another relation dbms service offered by GCP.
- This is different from cloud sql in many aspects
- This is a Google proprietary technology
- Costlier
- Stronger ACID values for ACID Refer Here
- More reliable
- Fully managed
- We choose Cloud spanner over Cloud SQL if
- Data sizes exceeding 10 TB
- Heavy usage QPS (Queries per second) exceeding 5000
- Users in multiple regions
