Google Cloud MySQL

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


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:

  1. Log in to the Google Cloud Console.

  2. Access the Google Cloud SQL Instances page and click your Instance ID.

  3. In the left navigation pane, click Replicas, and then, click + CREATE READ REPLICA.

    Create read replica

  4. Specify the instance information relevant to your requirements, and then, click Create.

    Specify instance information


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

  1. Access your Google Cloud MySQL instance.

  2. In the left navigation pane, select Backups.

  3. In Settings, check the status of Automated backups.

  4. 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.

    Create backup if automated backup is disabled

2. Enable BinLog replication

  1. In Backups, Settings, click + CREATE BACKUP.

  2. In the Edit backup settings dialog:

    1. Select the Automate backups and Enable point-in-time recovery check boxes.

    2. Click SAVE to activate the changes.

      Click Save

  3. Check the status of Automated backups again under Settings. It should appear as shown below.

    Updated BinLog settings

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:

  1. Access the Google Cloud MySQL Instances page and click on the Instance ID that you want to use.

    Select instance ID

  2. In the left navigation pane, click Connections.

  3. In the Connections page, select the Public IP checkbox.

    Add IP addresses to be whitelisted

  4. 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.

  5. (Optional) Click Add network to add another I.P. address.

  6. 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, choose one of the following options:

Option 1. Configuring the user account using Google Cloud console

  1. Click the master Google Cloud MySQL instance.

    Select your instance

  2. In the left navigation pane, click the Users tab, and then, click + ADD USER ACCOUNT.

    Add user account

  3. Specify the user account information and click ADD.

    Specify user name and password

    You will specify this username and password while creating your Hevo Pipeline.

Option 2. Configuring the user account using MySQL client

  1. Log in to your MySQL instance as a root user.

  2. Run the following commands to create a new database user and grant SELECT and REPLICATION privileges

    CREATE 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

  1. Access the Google Cloud SQL Instances page.

  2. 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.

    Locate hostname and port

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

  1. Access the Google Cloud SQL Instances page.

  2. Click your <database instance>, and then, click the Databases tab.

    Click databases tab

    In this page, you can locate the name of the databases.


Specify Google Cloud MySQL Connection Settings

Specify the following settings in the Configure your Google Cloud MySQL Source page:

  • 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 host:

    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 that can read the tables in your database.

  • Database Password: Password for the database user.

  • 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 (for Pipelines with BinLog mode)

    • 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 Pipeline modes except Custom SQL. If enabled, Hevo automatically ingests data from tables created after the Pipeline has been built. If disabled, the new tables are listed in the Pipeline Detailed View in Skipped state, and you can manually include the ones you want and load their historical data.

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
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.
Last updated on 12 Oct 2021