Google Cloud MySQL Setup Guide link
Follow these instructions to replicate your Google Cloud MySQL database to your destination via Fivetran.
Prerequisiteslink
To connect your MySQL database to Fivetran, you need:
- MySQL version 5.6 or above.
- Your database host's IP (for example,
1.2.3.4
) or domain (your.server.com
) - Your database's port (usually
3306
) - TLS enabled on your database (if you want to connect to Fivetran directly)
- A unique replica ID for Fivetran. We need this ID because we connect to your database as a replica. We provide a random replica ID in your setup form, but you can provide your own if you'd prefer or if the form's replica ID conflicts with one of your existing replica IDs.
NOTE: The replica ID is a unique ID within the MySQL replica set. By default, the replica ID is a random integer greater than 1000.
NOTE: If you will be using binary log as your incremental sync mechanism, note Google Cloud MySQL automatically manages its binary log retention period. By default, binary logs are purged after 7 days. If your connector is paused for more than 7 days, you may be required to re-sync your data.
For the prerequisites for connecting via an SSH tunnel, see Fivetran's Connection Options page.
Setup instructionslink
Choose connection methodlink
Google Cloud MySQL products require client certificates to connect to a database that is configured to require SSL. Fivetran only supports Server Certificate authentication.
Decide whether to connect Fivetran to your MySQL database directly, using a Google Cloud Virtual Machine, or using Google Cloud Private Service Connect.
Connect directlylink
Select the Allow Unsecured Connections option from the Connections tab of your Cloud SQL instance.
IMPORTANT: You must have TLS enabled on your database to connect directly to Fivetran.
Connect through Google Cloud Virtual Machinelink
Create a Google Cloud Virtual Machine to act as a proxy to connect using one of these options:
- SSH tunneling with client certificates configured
- Google Cloud SQL Proxy
- Certificate forwarding using stunnel
Connect using Google Cloud Private Service Connect Betalink
IMPORTANT: You must have a Business Critical plan to use Google Cloud Private Service Connect.
Google Cloud Private Service Connect allows VPCs and Google-hosted or on-premises services to communicate with one another without exposing traffic to the public internet. Learn more in Google Cloud's Private Service Connect documentation.
Follow our Google Cloud Private Service Connect setup guide to configure Private Service Connect for your database.
Choose incremental sync mechanismlink
To keep your data up to date after the initial sync, we use one of the following incremental sync methods:
- Binary log
- Fivetran Teleport Sync Private Preview
Each of these methods keeps a record of recent data changes, which allows Fivetran to update only the data that has changed since our last sync.
To learn the differences between the two mechanisms, see our incremental update documentation.
Allow accesslink
Your Google Cloud MySQL master or replica server needs to be made accessible to Fivetran's data processing server.
In your MySQL Dashboard, select the "Master" instance you would like to use.
IMPORTANT: If you're using a replica, select Replicas from the left menu, then choose the Replica instance that you want to connect to Fivetran.
Note the Master or Replica IP address and port number (3306 by default).
Add Fivetran's IP addresses to access the port number of your master or replica node unless you already have 0.0.0.0/0 as an allowed network.
Create user and configure incremental updateslink
Next, you must create a Fivetran user in your Google Cloud MySQL database. Make sure to do this on the master node because replicas are read-only.
How you create a user depends on which incremental update mechanism you are using. Follow the instructions below for your incremental update mechanism Step 2:
WARNING: This user must be reserved for Fivetran use only and must be unique to your connector. For more information, see our MySQL documentation.
Binary loglink
Open a connection to your Google Cloud MySQL database using your favorite SQL tool (for example, MySQL Workbench or the "mysql" command in your operating system's terminal window).
Create a Fivetran user and grant replication permissions by running the following SQL commands. Replace
<username>
andpassword
with a username and password of your choice.CREATE USER '<username>'@'%' IDENTIFIED BY 'password'; GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO '<username>'@'%';
NOTE: You must grant the Fivetran user SELECT permissions for all of the columns in the tables that you want to sync. When we do not have SELECT access to all columns in a table, we trigger a re-sync for that table, which slows down your syncs. If you don't want to sync certain columns, you can exclude them from your syncs in the Fivetran dashboard.
Check that binary logging is enabled (optional)link
By default, Google enables binary logging through point-in-time recovery for MySQL master databases. To confirm that binary logging is enabled on your database, follow the steps below.
NOTE: If you are using a read replica, you must enable binary logging in your read replica. Read Google Cloud's Replication in Cloud SQL documentation to see which databases support enabling binary logging on read replicas and the Point-in-time recovery documentation to learn how to enable it.
In your MySQL Dashboard, click Backups in the left menu.
In the Settings section, confirm that Enable point-in-time recovery is set to Enabled.
If point-in-time recovery is disabled, you must enable it. Click Edit.
In the Edit backups settings window, select the Enable point-in-time recovery box to enable binary logging.
Click Save.
NOTE: Your Cloud SQL instance will restart when you enable point-in-time recovery.
Fivetran Teleport Sync Private Previewlink
Open a connection to your MySQL primary database using your favorite SQL tool (for example, MySQL Workbench or the
mysql
command in your operating system's terminal window).Create a Fivetran user and grant SELECT permissions by running the following SQL commands. Replace
<username>
andpassword
with a username and password of your choice.CREATE USER '<username>'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; -- Option 1: Grant user SELECT permission on all tables and columns GRANT SELECT ON *.* TO '<username>'@'%'; -- Option 2: Grant user SELECT permission on only specified table and columns GRANT SELECT ON <tables/columns> TO '<username>'@'%';
Finish Fivetran configurationlink
In your connector setup form, enter a destination schema prefix. This prefix applies to each replicated schema and cannot be changed once your connector is created.
In the Host field, enter your database host's IP (for example,
1.2.3.4
) or domain (for example,your.server.com
)Enter your database instance's port number (usually
3306
).Enter the Fivetran-specific user that you created in Step 4.
Enter the password for the Fivetran-specific user that you created in Step 4.
Choose your connection method. If you selected Connect via an SSH tunnel, provide the following information:
- SSH hostname (do not use a load balancer's IP address/hostname)
- SSH port
- SSH user
- If you enabled TLS on your database in Step 1, set the Require TLS through tunnel toggle to ON.
(Binary log only) Enter a unique replica ID for Fivetran. We provide a random replica ID, but you can provide your own if you'd prefer or if the setup form's replica ID conflicts with one of your existing replica IDs.
Click Save & Test. Fivetran tests and validates our connection to your Google Cloud MySQL database. Upon successful completion of the setup tests, you can sync your data using Fivetran.
Setup testslink
Fivetran performs the following tests to ensure that we can connect to your Google Cloud MySQL database and that it is properly configured:
- The Connecting to SSH Tunnel Test validates the SSH tunnel details you provided in the setup form. It generates a pop-up window where you must verify the SSH fingerprint. It then checks that we can connect to your database using the SSH Tunnel. (We skip this test if you are connecting directly.)
- The Connecting to Host Test verifies that the database host is not private and checks that we can connect to the host.
- The Validating Certificate Test generates a pop-up window where you must choose which certificate you want Fivetran to use. It then validates that certificate and checks that we can connect to your database using TLS. (We skip this test if you are connecting using an SSH tunnel and did not choose to require TLS.)
- The Validating Database User Test validates the database credentials you provided in the setup form.
- (Binary log only) The Checking Database Configuration Test verifies that we can find your database's server ID. It then checks your binary log configuration and confirms that we can connect to the binary log.
- The Validating Database Type Test checks that your database type matches the connector type. For example, this test will fail if you try to set up a Google Cloud MySQL connector with a MySQL RDS database. To perform this test, the Fivetran user needs permission to access the
mysql
system database, though we do not sync any data from that DB. - The Validating Speed Setup test checks how quickly Fivetran can fetch data from your source database. During this test, we measure our ability to download sample data from your source database to Fivetran, but we do not perform a historical sync. We start a timer, then download the sample data in memory. We then calculate the connector speed based on how much data we downloaded and how long it took to download. The test shows a warning if the download speed is less than 5MB/sec.
NOTE: The tests may take a few minutes to finish running.
Related articleslink
description Connector Overview
account_tree Schema Information
settings API Connector Configuration