All Products
Search
Document Center

Flink ADB Connector

Last Updated: Sep 03, 2020

This topic describes how to write the data of Apache Flink to AnalyticDB for MySQL.

Procedure

  1. Download flink-jdbc-adb-compatibility_2.11-1.10.10.jar.

  2. Go to the /home/admin/flink-1.10.1/lib directory of each Apache Flink node and replace the flink-jdbc_2.11-1.10.1.jar file with flink-jdbc-adb-compatibility_2.11-1.10.10.jar.

  3. Restart all the Apache Flink nodes.

  4. Create an AnalyticDB for MySQL table in Apache Flink.

    CREATE TABLE table_test (
     col1 VARCHAR,
     col2 BIGINT,
     col3 BIGINT
    ) WITH (
     'connector.type' = 'jdbc', -- Use a JDBC connector.
     'connector.dialect'='adb ', -- Use the connector dialect.
     'connector.url' = 'jdbc:mysql://ip:port/db_name', -- jdbc url
     'connector.table' = 'table_name', -- The name of the table.
     'connector.username' = 'xxx', -- The user name of the account that owns the destination AnalyticDB for MySQL cluster.
     'Connector.password'='xxx ', -- The password of the account that owns the destination AnalyticDB for MySQL cluster.
    );

    For more information about Apache Flink, see Flink.