Deployment

Currently, InLong Sort is based on Flink, before you run an InLong Sort Application,

you need to set up Flink Environment.

Currently, InLong Sort relies on Flink-1.13.5. Chose flink-1.13.5-bin-scala_2.11.tgz when downloading package.

Prepare installation files

  • InLong Sort file, Download apache-inlong-[version]-bin.tar.gz
  • Data Nodes Connectors, Download apache-inlong-{version}-sort-connectors.tar.gz

Notice: Please put required Connectors jars into under FLINK_HOME/lib/ after download.

Start an inlong-sort application

  1. ./bin/flink run -c org.apache.inlong.sort.Entrance apache-inlong-[version]-bin/inlong-sort/sort-dist-[version].jar \
  2. --sql.script.file mysql-to-postgresql.sql

Configuration

/YOUR_SQL_SCRIPT_DIR/mysql-to-postgresql.sql is a sql script file includes multi Flink SQL statements that can be separated by semicolon.
Statement can support CREATE TABLE, CRETAE VIEW, INSERT INTO. We can write sql to do data integration.

We can write following SQL script if we want to read data from MySQL and write into PostgreSQL.

  1. CREATE TABLE `table_1`(
  2. `age` INT,
  3. `name` STRING)
  4. WITH (
  5. 'connector' = 'mysql-cdc-inlong',
  6. 'hostname' = 'localhost',
  7. 'username' = 'root',
  8. 'password' = 'inlong',
  9. 'database-name' = 'test',
  10. 'scan.incremental.snapshot.enabled' = 'false',
  11. 'server-time-zone' = 'GMT+8',
  12. 'table-name' = 'user'
  13. );
  14. CREATE TABLE `table_2`(
  15. PRIMARY KEY (`name`) NOT ENFORCED,
  16. `name` STRING,
  17. `age` INT)
  18. WITH (
  19. 'connector' = 'jdbc',
  20. 'url' = 'jdbc:postgresql://localhost:5432/postgres',
  21. 'username' = 'postgres',
  22. 'password' = 'inlong',
  23. 'table-name' = 'public.user',
  24. 'port' = '3306'
  25. );
  26. INSERT INTO `table_2`
  27. SELECT
  28. `name` AS `name`,
  29. `age` AS `age`
  30. FROM `table_1`;