Cloud SQL for MySQL source setup guide
This is a step-by-step guide on how to configure your Cloud SQL for MySQL instance for replicating its data via the MySQL ClickPipe.
Enable binary log retention
The binary log is a set of log files that contain information about data modifications made to an MySQL server instance, and binary log files are required for replication.
Enable binary logging via PITR
The PITR feature determines whether binary logging is turned on or off for MySQL in Google Cloud. It can be set in the Cloud console, by editing your Cloud SQL instance and scrolling down to the below section.
Setting the value to a reasonably long value depending on the replication use-case is advisable.
If not already configured, make sure to set these in the database flags section by editing the Cloud SQL:
binlog_expire_logs_secondsto a value >=86400(1 day).binlog_row_metadatatoFULLbinlog_row_imagetoFULL
To do this, click on the Edit button in the top right corner of the instance overview page.
Then scroll down to the Flags section and add the above flags.
Configure a database user
Connect to your Cloud SQL MySQL instance as the root user and execute the following commands:
-
Create a dedicated user for ClickPipes:
-
Grant schema permissions. The following example shows permissions for the
clickpipesdatabase. Repeat these commands for each database and host you want to replicate: -
Grant replication permissions to the user:
Configure network access
If you want to restrict traffic to your Cloud SQL instance, please add the documented static NAT IPs to the allowlisted IPs of your Cloud SQL MySQL instance.
This can be done either by editing the instance or by heading over to the Connections tab in the sidebar in Cloud console.
Download and use root CA certificate
To connect to your Cloud SQL instance, you need to download the root CA certificate.
- Go to your Cloud SQL instance in the Cloud console.
- Click on
Connectionsin the sidebar. - Click on the
Securitytab. - In the
Manage server CA certificatessection, click on theDOWNLOAD CERTIFICATESbutton at the bottom.
- In the ClickPipes UI, upload the downloaded certificate when creating a new MySQL ClickPipe.