DLH.io Documentation logoDLH.io Documentation
DestinationsMysql

Basic MySQL Setup

DLH.io documentation for Basic MySQL Setup

Let's connect your MySQL database

Go ahead and gather the basic details:

  • Database host or IP Address
  • Database port # (default is 3306)
  • Replica ID for DLH.io
    • We connect to the MySQL datbase as a replica and thefore need to use this unique id to avoid conflicts with your existing replica IDs. The number will be a number greater than 100000 so this should eliminate any replica id conflict concerns.
    • Not needed when you choose Binary Log (binlog). DLH.io then assigns each Sync Bridge its own replica ID automatically.

MySQL Specifications Required:

  • All recent and LTS versions (5.5 or above) are supported
  • The Binary Log (binlog) change capture option requires MySQL 8.0.1 or above (including Amazon RDS, Aurora MySQL, Google Cloud SQL and Azure Database for MySQL)
  • Determine which way to connect: TLS or SSH Tunneling
  • Firewalls on your database server should allow incoming connections through the public internet on your MySQL port (typically 3306 unless your network team has changed it). Be sure to whitelist our DLH.io IP addresses for your database server network access.
  • When you choose Binary Log (binlog), binlog_row_metadata must be set to FULL. The default Full or Modified Date Column option does not read the binary log, so this setting does not affect it.

Instructions (Basic Connection Setup)

Scroll down to ensure you review all steps, as needed...

Remember DLH.io connects to your database instance with credentials supplied by you. We store your credentials securely with our bank-grade protocols.

  1. Create a DLH.io user on the MySQL database
    • Connect to the MySQL database in question with your admin user.

    • Create a user for DLH.io using the following MySQL logic, replacing <new_username> with a user name that you choose (we recommend 'datalakehouse_ro' to signify a read-only user), and choose a good password that complies with your security policies:

      CREATE USER <new_username>@'%' IDENTIFIED WITH mysql_native_password BY 'tmp!password';
      GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO <new_username>@'%';
  2. Enter your Credentials and Other Information in the Fields
    • Enter in the Name/Alias field, the name you'll use within DLH.io to differentiate this connection from others
    • Enter in the Target Schema Prefix field, is the prefix of schema(s) that gets created on your destination target connection database for each of the schemas you load in this connection. So if your database has a schema named 'dbo' the target connection when synced will have a schema in that target database named the value of this field + '_dbo'.
      • Alphanumeric characters only. It must start and end with a letter but can contain an underscore(_).
    • Enter in the Server/Host field, the name of the public server name or the IP Address (most customers use the IP for this field)
    • Enter in the Port field, where this database is accessible and the firewall restrictions are open
    • Enter in the Database field, the name of the database to connect
    • Enter in the Userame/Alias field, the username of user you created in the steps above to give access to DLH.io
    • Leave Auth Type field alone. It is set to password because DLH.io is using TLS and requires username and password credentials to access the database
    • Enter in the Password field, the password for the user you created in the steps above
    • Choose the change capture option: Full or Modified Date Column (Default), or Binary Log (binlog) to capture inserts, updates and deletes from the binary log. Binlog requires the settings in the Enable Change Tracking and BinLog section below.
  3. Click Save & Test
    • This attempt to connect to your database with the credentials provided.
    • When Binary Log (binlog) is chosen, the test also checks every binlog setting listed below and names any that need to change.
    • A message of success or failure will be shown
      • If success you'll be prompted with the schema objects objects of the database and will need to complete the final steps for configuration shown below.
      • If failure happens with the test connection, the connection is still saved but you will need to correct the failure based on the failure reason information provided in the message
  4. ...

Instructions (Continued & Final Setup)

This section of steps ensures you have coverage of other important steps required on your database side and in DLH.io once you have completed the above test connection successfully.

Enable Change Tracking and BinLog

Required only when you choose Binary Log (binlog).

  • To capture incremental loading delta changes of the database records being synchronized and to reduce cost we use this native feature of MySQL.

  • Connect to your MySQL database server and access the file system

  • Access the MySQL configuration file (Ex: /etc/my.cnf)

    • For more instructions follow the MySQL binlog setup process from the MySQL documentation
  • Make sure the file has the lines as follows in the [mysqld] section to enable ROW formatting binary log replication:

    [mysqld]
    binlog-format=ROW
    binlog-row-image=FULL
    binlog-row-metadata=FULL
    log-bin=mysql-binlog
    server-id=0000012345
    binlog-expire-logs-seconds=604800
    log-slave-updates=1
    • Name the binary log, log-bin attribute, mysql-binlog
    • Make sure a server-id exists with any number between 1 and 4000000000
    • Keep binary logs for at least 1 day (86400 seconds); we recommend 7 days (604800 seconds) so a paused or failed sync can catch up. If the logs DLH.io needs are no longer on the server, the Sync Bridge is flagged for a resync.
    • Leave binlog_transaction_compression OFF, and do not include PARTIAL_JSON in binlog_row_value_options
    • The server time_zone must be a named zone (for example America/New_York) or UTC, not a fixed offset
  • Restart your MySQL server in order for the changes to propagate

  • Managed services:

    • Amazon RDS / Aurora MySQL: set binlog_format, binlog_row_image and binlog_row_metadata in the DB parameter group (Aurora: enable binary logging in the cluster parameter group), then set retention with CALL mysql.rds_set_configuration('binlog retention hours', 168);
    • Google Cloud SQL: enable point-in-time recovery, which turns on binary logging, and set the same flags as database flags
    • Azure Database for MySQL: set the same values as server parameters
  • Determine that your binlog is configured correctly by running Save & Test with Binary Log (binlog) chosen

  • Only one Sync Bridge per MySQL connection can use Binary Log (binlog). To sync the same database to another destination, create a second connection.

Other Information About This Connection

From time to time we will update the instruction set here to inform you about this connection or how specifically we must connect to optimally synchronize your data.

If you require any other type of authorization to connect to your account instance please reach out to our support team via our DLH.io Support Portal.