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'@'%';
    

Retrieve the Configuration Details (Optional)

1. Retrieve the hostname and port number

  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.


Limitations

  • Hevo does not fetch Views from the MySQL database automatically.

    As a workaround, you can create individual Pipelines in Custom SQL mode to fetch each View. 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.

Last updated on 22 Feb 2021