MariaDB MySQL

MariaDB is is a community-developed, commercially supported fork of the MySQL RDBMS, with the same database structure and indexes as MySQL.

You can ingest data from your MariaDB database using Hevo Pipelines and replicate it to a warehouse of your choice.

Prerequisites


Perform the following steps to configure your MariaDB MySQL Source:

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 MySQL servers via binary logs (BinLog). For this, binary logging must be enabled on your MySQL server. You can do this via the MySQL server configuration file or via server startup options to mysqld.

Follow these steps to set up BinLog replication:

1. Check if BinLog replication is already enabled

  1. Open a secure MariaDB shell:

    mysql -u username -p
    
  2. Enter the password for the user:

  3. Enter the command:

    select @@log_bin;
    

    If this statement returns a value of 1, BinLog is active. If value returned is 0, this means that BinLog is disabled. To enable it, follow the steps below.

2. Enable BinLog replication

  1. Log in to your MariaDB server.

  2. View your MariaDB server configuration:

    sudo nano etc/mysql/mariadb.conf.d/50-server.cnf
    

    (This may be sudo nano /etc/my.cnf in some cases)

  3. In the configuration file, ensure the following configurations are specified. If not specified, add them now.

     [mysqld]
     binlog_format=ROW
     binlog_row_image=FULL
     server-id=1
     expire_logs_days=3
     log_bin=/var/log/mysql/mysql-bin.log)
     log_slave_updates=1
     max_binlog_size = 100M
    

    Note: The log_slave_updates setting is required only if you are connecting a read replica. When it is set to 1, updates received by a replica server from a source server are logged to the replica’s own binary log.

  4. Restart the MariaDB SQL server instance by entering the following command:

     sudo service mysql restart
    
  5. After restart, log in to the MariaDB server to check BinLog again:

     SELECT @@log_bin;
    

The value returned is now 1, indicating that BinLog is active.

Note: The retention period should ideally be at least 72 hours (3 days). This helps Hevo ensure that no log-file is missed from being read, specially when Historical Data loading is enabled.

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

Follow these steps to whitelist the Hevo IP address for your region and enable Hevo to connect to your MariaDB database:

  1. Edit the MariaDB server configuration:

    sudo vim etc/mysql/mariadb.conf.d/50-server.cnf
    
  2. Scroll to [mysqld] and add:

     bind-address = 0.0.0.0
    

    Or

     bind-address = 10.2.7.152
    

    (Check the Hevo IP address for your region)

  3. Save the file.


Grant Privileges to the User

The database user specified in the Hevo Pipeline must have the following global privileges:

  • SELECT

  • SUPER or (REPLICATION_CLIENT and REPLICATION_SLAVE)

To set up these privileges:

  1. Go to your MariaB MySQL server. For example:

     mysql -u root -p
    
  2. Grant SELECT privileges to the user:

     GRANT SELECT ON *.* to jacob@localhost;
    
  3. (Optional) View the grants for the user:

     show grants for jacob@localhost;
    

Specify MariaDB Connection Settings

Specify the following settings in the Configure your MariaDB 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 Step 3 of section, Enable BinLog replication.
Jul-26-2021 1.68 Added a note for the Database Host field.
Jul-12-2021 NA Added section, Specify MariaDB Connection Settings.
Last updated on 12 Oct 2021