Google Cloud MySQL
On This Page
Google Cloud SQL offers MySQL as a fully-managed web service. You can use Google Cloud SQL to host your MySQL database in Google Cloud Platform, and let Google Cloud handle administrative tasks such a replication, patch management, and database management for it.
You can ingest data from your Google Cloud MySQL database using Hevo Pipelines and replicate it to a Destination of your choice.
Prerequisites
-
The Google Cloud MySQL instance (not localhost) is running. To check this, access your Google Cloud MySQL server and look for an Active indication next to the instance name.
-
The MySQL version is 5.1 or higher. You can select the MySQL version while creating the instance.
-
Binary Log (BinLog) replication is enabled, if Pipeline mode is BinLog.
-
SELECT and REPLICATION privileges are granted to the database user.
Perform the following steps to configure your Google Cloud MySQL Source:
Create a Read Replica (Optional)
If you are using an existing read-replica or connecting Hevo to your master database, skip to Set up MySQL Binary Logs for Replication section.
To create a read-replica:
-
Log in to the Google Cloud Console.
-
Access the Google Cloud SQL Instances page and click your Instance ID.
-
In the left navigation pane, under Backups, click Replicas, and then, click + CREATE READ REPLICA.
-
Specify the instance information relevant to your requirements, and then, click Create.
Set up MySQL Binary Logs for Replication
A binary log is a collection of log files that records information about data modifications and data object modifications made on a MySQL server instance. Typically binary logs are used for data replication and data recovery.
Hevo supports data ingestion for replication from servers via binary logs (BinLog). For this, binary logging must be enabled on your Google Cloud MySQL server.
To do this:
1. Check if BinLog replication is already enabled
-
Access your Google Cloud MySQL instance.
-
In the left navigation pane, under Databases, select Backups.
-
In Settings, check the status of Automated backups.
-
If the status is Disabled, follow the steps provided below to enable BinLog replication. If the status is Enabled, click Edit Settings and follow the steps provided below.
2. Enable BinLog replication
-
In Backups, Settings, click + CREATE BACKUP.
-
In the Edit backup settings dialog:
-
Select the Automate backups and Enable point-in-time recovery check boxes.
-
Click SAVE to activate the changes.
-
-
Check the status of Automated backups again under Settings. It should appear as shown below.
This confirms that binary logging is now enabled for your Google Cloud MySQL instance.
Read BinLog Replication and BinLog Alerts.
The replication reference guide on MySQL’s documentation portal provides a complete reference of the options available for replication and binary logging.
Whitelist Hevo’s IP Addresses
You need to whitelist the Hevo IP address for your region to enable Hevo to connect to your Google Cloud MySQL database:
-
Access the Google Cloud MySQL Instances page and click on the Instance ID that you want to use.
-
In the left navigation pane, under Overview, click Connections.
-
In the Connections page, select the Public IP check box.
-
Specify the following in the Edit Network section and click Done:
-
Name: A name for this connection. For example, all or Hevo IP address.
-
Network: The IP address of the site to grant access to. Specify 0.0.0.0/0 to authorize all sites or 10.2.7.152 to specifically whitelist Hevo’s IP address. Check the Hevo IP address for your region.
This adds the IP address to the list of Authorized networks.
-
-
(Optional) Click Add network to add another I.P. address.
-
Click Save.
Create a User and Grant Privileges
MySQL allows you to connect to Hevo after you configure your Google Cloud MySQL instance as an existing user or as a new user. To do this, select one of the following options:
Option 1. Configuring the user account using Google Cloud console
-
Click the master Google Cloud MySQL instance.
-
In the left navigation pane, under Connections, click the Users tab, and then, click + ADD USER ACCOUNT.
-
Specify the user account information and click ADD.
You will specify this username and password while creating your Hevo Pipeline.
Option 2. Configuring the user account using MySQL client
-
Log in to your MySQL instance as a
root
user. -
Run the following commands to create a new database user and grant
SELECT
andREPLICATION
privilegesCREATE USER 'hevo'@'%' IDENTIFIED BY '<password>'; GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'hevo'@'%';
Note: The
REPLICATION SLAVE
privilege is required only if you are connecting a read replica. When it is granted to the authenticating user, updates received by a replica server from a source server are logged to the replica’s own binary log.
Retrieve the Configuration Details (Optional)
1. Retrieve the hostname and port number
Note: Following is an example of Google Cloud MySQL hostname and port number:
Host : 35.220.150.0
Port : 3306
-
Access the Google Cloud SQL Instances page.
-
Locate the hostname of the master and the replica instance under Public IP address column. The Google Cloud MySQL port value is 3306 by default.
You will specify these while creating your Hevo Pipeline.
2. Retrieve the username and password
To retrieve your username and password, or create a new user to connect to Hevo, read Create a User and Grant Privileges.
3. Retrieve the database names
-
Access the Google Cloud SQL Instances page.
-
Click your <database instance>, and then, click the Databases tab.
In this page, you can locate the name of the databases.
Specify Google Cloud MySQL Connection Settings
In the Configure your Google Cloud MySQL Source page, specify the following:
-
Pipeline Name: A unique name for your Pipeline.
-
Database Host: The MySQL host’s IP address or DNS.
The following table lists a few examples of MySQL hosts:
Variant Host Amazon RDS MySQL mysql-rds-1.xxxxx.rds.amazonaws.com Azure MySQL mysql.database.windows.net Generic MySQL 10.123.10.001 or mysql-replica.westeros.inc Google Cloud MySQL 35.220.150.0 Note: For URL-based hostnames, exclude the http:// or https:// part. For example, if the hostname URL is http://mysql-replica.westeros.inc, enter mysql-replica.westeros.inc.
-
Database Port: The port on which your MySQL server is listening for connections. Default value: 3306.
-
Database User: The authenticated user who has the permissions to read tables in your database.
-
Database Password: The password for the database user.
-
Select an Ingestion Mode: The desired mode by which you want to ingest data from the Source. The available Ingestion Modes are Binlog, Table, and Custom SQL. Read Ingestion Modes.
For Ingestion mode as Table, read Object Settings for steps to configure the objects to be replicated.
-
Database Name: The database you want to load data from if the Pipeline mode is Table or Custom SQL.
-
Connection Settings
-
Connect through SSH: Enable this option to connect to Hevo using an SSH tunnel, instead of directly connecting your MySQL database host to Hevo. This provides an additional level of security to your database by not exposing your MySQL setup to the public. Read Connecting Through SSH.
If this option is disabled, you must whitelist Hevo’s IP addresses. Refer to the content for your MySQL variant for steps to do this.
-
Use SSL: Enable it to use SSL encrypted connection. To enable this, specify the following:
-
CA File: The file containing the SSL server certificate authority (CA).
-
Client Certificate: The client public key certificate file.
-
Client Key: The client private key file.
-
-
-
Advanced Settings
-
Load All Databases: Applicable for Pipelines with BinLog mode. If this option is enabled, Hevo loads the data from all databases on the selected host. Else, specify a comma-separated list of Database Names you want to load data from.
-
Load Historical Data: Applicable for Pipelines with BinLog mode. If this option is enabled, the entire table data is fetched during the first run of the Pipeline. If disabled, Hevo loads only the data that was written in your database after the time of creation of the Pipeline.
-
Merge Tables: Applicable for Pipelines with BinLog mode. If this option is enabled, Hevo merges tables with the same name from different databases while loading the data to the warehouse. Hevo loads the Database Name field with each record. If disabled, the database name is prefixed to each table name. Read How does the Merge Tables feature work?.
-
Include New Tables in the Pipeline: Applicable for all Ingestion modes except Custom SQL.
If enabled, Hevo automatically ingests data from tables created in the Source after the Pipeline has been built. These may include completely new tables or previously deleted tables that have been re-created in the Source.
If disabled, new and re-created tables are not ingested automatically. They are added in SKIPPED state in the objects list, in the Pipeline Overview page. You can update their status to INCLUDED to ingest data.
You can change this setting later.
-
Click TEST & CONTINUE to proceed for setting up the Destination.
Limitations
-
Hevo only fetches tables from the MySQL database. It does not fetch other entities such as functions, stored procedures, views, and triggers.
To fetch views, you can create individual Pipelines in Custom SQL mode. However, some limitations may arise based on the type of data synchronization, the query mode, or the number of Events. Contact Hevo Support for more details.
See Also
Revision History
Refer to the following table for the list of key updates made to this page:
Date | Release | Description of Change |
---|---|---|
Apr-21-2022 | 1.86 | Updated section, Specify Google Cloud MySQL Connection Settings. |
Aug-09-2021 | NA | Added a note in section, Option 2 Configuring the user account using MySQL client. |
Jul-26-2021 | 1.68 | Added a note for the Database Host field. |
Jul-12-2021 | NA | Added section, Specify Google Cloud MySQL Connection Settings. |