ChunJun Documentation

repository·master·Indexed 26 days ago

https://github.com/dtstack/chunjun

ChunJun (formerly FlinkX) is a distributed integration framework based on Apache Flink for data synchronization and calculation between heterogeneous data sources such as MySQL, Oracle, Hive, and Kudu using JSON templates or SQL scripts. It supports multiple deployment modes including Local, Standalone, YARN (Per-Job and Session), and Kubernetes (Application and Session).

Tokens
86.2K
Snippets
97
Records
465
Agent score
86%

What's inside ChunJun

  1. Overview of HDFS Source Plugin

    master

    The HDFS Source plugin allows reading from and writing to HDFS paths for text, orc, and parquet file types. It is commonly used with Hive tables by reading/writing data directly to the HDFS paths corresponding to Hive partitions.

    Important Limitations:

    • The plugin does not perform any DDL operations on Hive tables.
    • It does not save file offsets during checkpoints, meaning it does not support incremental/resume execution (续跑).
  2. Overview of HDFS Sink

    master

    The HDFS Sink plugin allows reading from and writing to HDFS paths using TextFile, Orc, or Parquet formats. It is commonly used with Hive tables by writing data directly to the HDFS paths corresponding to Hive partitions.

    Key Behaviors:

    • It does not perform any DDL operations on Hive tables.
    • When checkpoint is enabled, it uses a two-phase commit mechanism: data is first generated in a .data directory, then copied to the formal directory and marked. In the commit phase, marked files in .data are deleted; in the rollback phase, marked files in the formal directory are deleted.
  3. Overview of Hive Sink

    master

    The Hive sink plugin enables real-time writing of data into Hive tables. It supports automatic table creation and automatic partition creation based on the current system time. It also supports dynamic table name parsing and group mapping to route different data to different Hive tables based on mapping rules.

    Key Features:

    • Automatic Table/Partition Creation: Automatically creates tables if they don't exist and creates partitions based on the configured partitionType.
    • Dynamic Routing: Uses analyticalRules to resolve table names from the incoming data stream.
    • Data Integrity: Requires checkpoint to be enabled. ChunJun uses a two-phase commit mechanism: data is first written to a .data directory, then copied to the official directory during the commit phase. This ensures data is only visible in Hive after a successful checkpoint.
  4. Overview of ChunJun

    master
    ChunJun (formerly FlinkX) is a stable, efficient, and easy-to-use data integration framework for batch and stream processing. It is built on the Apache Flink real-time computing engine and facilitates data synchronization and computation between various heterogeneous data sources. It supports JSON template configurations and is compatible with Flink SQL syntax.
  5. Use GBase Lookup connector

    master

    The GBase Lookup connector is used for GBase dimension table lookups. It supports two caching modes:

    1. Full Cache (ALL): Loads the entire dimension table into memory. Recommended for small datasets that do not change frequently.
    2. Asynchronous Cache (LRU): Queries data asynchronously and uses an LRU (Least Recently Used) cache in memory. Recommended for large datasets.

    Supported GBase Version:

    • GBase8a (8.6.2.43)

    Plugin Names:

    • SQL: gbase-x
    • Connector: gbase-x
  6. Understand Oracle LogMiner Principles

    master

    LogMiner is an Oracle tool used to parse RedoLog (and archived log) files to extract specific data changes as SQL statements. It is composed of PL/SQL packages and dynamic views.

    Key concepts:

    • RedoLog: Records all changes to user data or the database dictionary. Oracle uses a circular writing method for RedoLogs.
    • RedoLog Types:
      • Current log group (found via v$log and v$logfile).
      • Archived RedoLog files (found via v$archived_log).
    • Data Extraction: By loading RedoLog files into LogMiner, the parsed data becomes available in the V$LOGMNR_CONTENTS view, which can be queried via SQL to obtain real-time data.
  7. Understand the ChunJun Job Configuration Structure

    master

    A complete ChunJun job script configuration consists of two main sections: content and setting.

    • content: Configures the data source and destination. It contains a list of reader and writer configurations.
    • setting: Configures the global environment for the task, including concurrency, error handling, metrics, restoration, and logging.

    Basic structure:

    {
      "job": {
        "content": [
          {
            "reader": {},
            "writer": {}
          }
        ],
        "setting": {
          "speed": {},
          "errorLimit": {},
          "metricPluginConf": {},
          "restore": {},
          "log": {},
          "dirty": {}
        }
      }
    }
    {
      "job": {
        "content": [
          {
            "reader": {},
            "writer": {}
          }
        ],
        "setting": {
          "speed": {},
          "errorLimit": {},
          "metricPluginConf": {},
          "restore": {},
          "log": {},
          "dirty": {}
        }
      }
    }