GCP Data Engineer : Cloud SQL / Cloud Spanner

GCP Data Engineer : Cloud SQL / Cloud Spanner

Overview

CloudSQL supports to store structured data and it comes under SQL category in GCP.

Use CloudSQL for below use-cases

Structured Data
Predefined Schemas
ACID Transactions
Strong Consistency
Tables, Partitions, Indexes, Views and Constraints 

Login to cloud console, navigate to Database section and choose SQL

No alt text provided for this image


Supported Database Engines

CloudSQL right now supports

MySQL
PostgreSQL
SQLServer
No alt text provided for this image

Configuring Cloud SQL Instance

To launch a PostgreSQL instance, choose PostgreSQL and fill in Instance ID, Password and choose specific version to launch

No alt text provided for this image

Cloud SQL supports regional availability. Below screen helps to choose region and zones ( for highly available , pls choose Multiple Zones )

No alt text provided for this image


CloudSQL Machine types can be configured, based on the machine type, no of connections support may vary.

We have option to customize the machine type, by providing value for Cores and Memory as well.

Storage can be HDD or SSD. For better performance, choose SSD.Also we can specify the initial storage capacity for the instance and can enable the automatic storage increase option. This will help to dynamically increase the size, in case if the storage exceeds.
No alt text provided for this image

Encryption

GCP Storage supports Google -managed encryption key by default.

No alt text provided for this image

Connection Types

Connecting to the instance can be made public or it can be set to Private IP for security reasons.

For API development, best practice is to use Cloud SQL Proxy to connect with Service containers. Cloud SQL Proxy can be run as side-car container to enable service to connect to CloudSQL instance
No alt text provided for this image

Backups

CloudSQL backups data by choosing the option as below. Hence there will be a downtime, whereas in Cloud Spanner there will not be a downtime as its been managed by GCP

No alt text provided for this image
No alt text provided for this image

Cloud SQL Monitoring

Once the instance is launched, user can able to monitor the instance using below dashboard.

Metrics based on CPU Utilization, Memory Usage , Active connections will be captured here.

No alt text provided for this image

Cloud Spanner

In addition to the features supported by Cloud SQL, if you need High Availability ( Global, MultiRegional), Horizontal Scaling and Zero Downtime, go for Cloud Spanner

Login to cloud console, choose spanner option

No alt text provided for this image

Enable Spanner API and launch instance as below by choosing multi-regional ( for high availability ). 

No alt text provided for this image

Spanner supports horizontal scaling ,zero downtime and automatic replication.

Happy Learning !

Bharathy Poovalingam

#GCP #CloudSQL#CloudSpanner #iGreenData #Learning

To view or add a comment, sign in

More articles by Bharathy Poovalingam

Others also viewed

Explore content categories