欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

seatunnel 2.3.1全流程部署使用教程

 更新時(shí)間:2023年05月22日 09:27:14   作者:zzuli_cyf  
SeaTunnel是一個(gè)非常易于使用的超高性能分布式數(shù)據(jù)集成平臺(tái),支持海量數(shù)據(jù)的實(shí)時(shí)同步,這篇文章主要介紹了seatunnel 2.3.1全流程部署使用,需要的朋友可以參考下

SeaTunnel是什么?

SeaTunnel下一代高性能、分布式、海量數(shù)據(jù)集成框架。SeaTunnel是一個(gè)非常易于使用的超高性能分布式數(shù)據(jù)集成平臺(tái),支持海量數(shù)據(jù)的實(shí)時(shí)同步。每天可以穩(wěn)定高效地同步數(shù)百億數(shù)據(jù),已被近百家公司用于生產(chǎn)。

SeaTunnel的核心特性有哪些?

  • 1.組件豐富(內(nèi)置豐富插件,支持各種數(shù)據(jù)產(chǎn)品方便快捷的傳輸和集成數(shù)據(jù))。

  • 2.高擴(kuò)展性(基于模塊化和插件化設(shè)計(jì),支持熱插拔, 帶來更好的擴(kuò)展性)。

  • 3.簡(jiǎn)單易用(特有的架構(gòu)設(shè)計(jì)下,使得開發(fā)配置更簡(jiǎn)單,幾乎零代碼,無使用成本)。

  • 4.成熟穩(wěn)定(經(jīng)歷多家企業(yè),大規(guī)模生產(chǎn)環(huán)境使用和海量數(shù)據(jù)的洗禮,穩(wěn)定健壯)。

Seatunnel 2.3.1 部署使用

1 部署

1.1 下載解壓

https://dlcdn.apache.org/incubator/seatunnel/2.3.1/apache-seatunnel-incubating-2.3.1-bin.tar.gz

下載完畢之后上傳到服務(wù)器上面并解壓

# 解壓到了/opt/module目錄下
tar -zxvf apache-seatunnel-incubating-2.3.1-bin.tar.gz -C /opt/module

1.2 下載對(duì)應(yīng)的connector

在apache的倉(cāng)庫(kù)下載相應(yīng)的connector,下載時(shí)每個(gè)jar包在不同的路徑下面,放到/seatunnel-2.3.1/connectors/seatunnel目錄下

https://repo.maven.apache.org/maven2/org/apache/seatunnel/

connector-assert-2.3.1.jar
connector-cdc-mysql-2.3.1.jar
connector-console-2.3.1.jar # 自帶的
connector-doris-2.3.1.jar
connector-elasticsearch-2.3.1.jar
connector-fake-2.3.1.jar # 自帶的
connector-file-hadoop-2.3.1.jar
connector-file-local-2.3.1.jar
connector-hive-2.3.1.jar
connector-iceberg-2.3.1.jar
connector-jdbc-2.3.1.jar
connector-kafka-2.3.1.jar
connector-redis-2.3.1.jar

配置安裝seatunnel的插件

vim  seatunnel-2.3.1/config/plugin_config

調(diào)用安裝腳本的時(shí)候會(huì)在maven的中央倉(cāng)庫(kù)下載對(duì)應(yīng)的jar包,盡量少放,下載太慢了,我放了這些

--connectors-v2--
connector-assert
connector-cdc-mysql
connector-jdbc
connector-fake
connector-console
--end--

1.3 安裝seatunnel

sh bin/install-plugin.sh 2.3.1

整個(gè)過程非常慢…應(yīng)該是從maven中央倉(cāng)庫(kù)下載東西

1.4 補(bǔ)充一些jar包

使用hive的話需要將這兩個(gè)jar放入到seatunnel-2.3.1/lib目錄下:

hive-exec-2.3.9.jar
# 下載鏈接
# https://repo.maven.apache.org/maven2/org/apache/hive/hive-exec/2.3.9/hive-exec-2.3.9.jar
# 注意這里是hive-exec-2.3.9.jar,不要從你的hive的lib目錄下拷貝最新的jar包,就用這個(gè)
seatunnel-hadoop3-3.1.4-uber-2.3.1.jar  
# 下載鏈接
# https://repo.maven.apache.org/maven2/org/apache/seatunnel/seatunnel-hadoop3-3.1.4-uber/2.3.1/seatunnel-hadoop3-3.1.4-uber-2.3.1.jar  
seatunnel-hadoop3-3.1.4-uber-2.3.1-optional.jar
# 下載鏈接
# hhttps://repo.maven.apache.org/maven2/org/apache/seatunnel/seatunnel-hadoop3-3.1.4-uber/2.3.1/seatunnel-hadoop3-3.1.4-uber-2.3.1-optional.jar

中間由于其他緣故我拷貝了一個(gè)hive框架/lib目錄下的libfb303-0.9.3.jar放到seatunnellib目錄下了。

  • 使用mysql的話需要將mysql的驅(qū)動(dòng)拷貝過來,應(yīng)該是需要8系列的mysql驅(qū)動(dòng),我這里使用的是mysql-connector-java-8.0.21.jar

2 測(cè)試樣例

2.1 官方demo fake to console

seatunnel-2.3.1/config/v2.batch.config.template

env {
  execution.parallelism = 2
  job.mode = "BATCH"
  checkpoint.interval = 10000
}
source {
  FakeSource {
    parallelism = 2
    result_table_name = "fake"
    row.num = 16
    schema = {
      fields {
        name = "string"
        age = "int"
      }
    }
  }
}
sink {
  Console {
  }
}

運(yùn)行命令

cd /opt/module/seatunnel-2.3.1
./bin/seatunnel.sh --config ./config/v2.batch.config.template -e lcoal

運(yùn)行成功的話會(huì)可以在console看到打印的測(cè)試數(shù)據(jù)

2.2 mysql to console

我新建了一個(gè)用來放運(yùn)行配置的目錄/opt/module/seatunnel-2.3.1/job

vim mysql_2console.conf

mysql_2console.conf

env {
  execution.parallelism = 2
  job.mode = "BATCH"
  checkpoint.interval = 10000
}
source{
    Jdbc {
        url = "jdbc:mysql://hadoop102/dim_db?useUnicode=true&characterEncoding=utf8&useSSL=false"
        driver = "com.mysql.cj.jdbc.Driver"
        connection_check_timeout_sec = 100
        user = "root"
        password = "xxxxxx"
        query = "select * from dim_basicdata_date_a_d where date < '2010-12-31'"
    }
}
sink {
    Console {
    }
}

查詢的是一張日期維表的數(shù)據(jù)

建表語句:

CREATE DATABASE dim_db DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
drop table if exists  dim_db.dim_basicdata_date_a_d;
create table if not exists dim_db.dim_basicdata_date_a_d
(
    `date`          varchar(40) comment '日期',
    `year`          varchar(40) comment '年',
    `quarter`       varchar(40) comment '季度(1/2/3/4)',
    `season`        varchar(40) comment '季節(jié)(春季/夏季/秋季/冬季)',
    `month`         varchar(40) comment '月',
    `day`           varchar(40) comment '日',
    `week`          varchar(40) comment '年內(nèi)第幾周',
    `weekday`       varchar(40) comment '周幾(1-周一/2-周二/3-周三/4-周四/5-周五/6-周六/7-周日)',
    `is_workday`    varchar(40) comment '是否是工作日(1-是,0-否)',
    `date_type`     varchar(40) comment '節(jié)假日類型(工作日/法定上班[調(diào)休]/周末/節(jié)假日)',
    `update_date`   varchar(40) comment '更新日期'
);

可以自己插入幾條數(shù)據(jù)試試

運(yùn)行命令

cd /opt/module/seatunnel-2.3.1
./bin/seatunnel.sh --config ./job/mysql_2console.conf  -e local

2.3 hive to console

創(chuàng)建一張hive表

CREATE database db_hive;
drop table if exists  db_hive.dim_basicdata_date_a_d;
create table if not exists db_hive.dim_basicdata_date_a_d
(
    `date`          string comment '日期',
    `year`          string comment '年',
    `quarter`       string comment '季度(1/2/3/4)',
    `season`        string comment '季節(jié)(春季/夏季/秋季/冬季)',
    `month`         string comment '月',
    `day`           string comment '日',
    `week`          string comment '年內(nèi)第幾周',
    `weekday`       string comment '周幾(1-周一/2-周二/3-周三/4-周四/5-周五/6-周六/7-周日)',
    `is_workday`    string comment '是否是工作日(1-是,0-否)',
    `date_type`     string comment '節(jié)假日類型(工作日/法定上班[調(diào)休]/周末/節(jié)假日)',
    `update_date`   string comment '更新日期'
);

自行插入幾條數(shù)據(jù)

創(chuàng)建配置文件hive_2console.conf

env {
  execution.parallelism = 2
  job.mode = "BATCH"
  checkpoint.interval = 10000
}
source{
  Hive {
    table_name = "db_hive.dim_basicdata_date_a_d"
    metastore_uri = "thrift://hadoop102:9083"
  }
}
sink {
    Console {
    }
}

這里我使用的hive連接方式是jdbc訪問元數(shù)據(jù),所以metastore_uri = "jdbc:hive2://hadoop102:10000"也可以正常使用。

hive-site.xml修改配置文件,有可能你已經(jīng)配置好了

    <!-- 為了方便連接,采用直連的方式連接到hive數(shù)據(jù)庫(kù),注釋掉下面三條配置信息 -->
    <!-- 指定存儲(chǔ)元數(shù)據(jù)要連接的地址 -->
        <property>
        <name>hive.metastore.uris</name>
        <value>thrift://hadoop102:9083</value>
    </property>
    <!-- 指定 hiveserver2 連接的 host -->
    <property>
        <name>hive.server2.thrift.bind.host</name>
        <value>hadoop102</value>
    </property>
    <!-- 指定 hiveserver2 連接的端口號(hào) -->
    <property>
        <name>hive.server2.thrift.port</name>
        <value>10000</value>
    </property>

運(yùn)行命令

cd /opt/module/seatunnel-2.3.1
./bin/seatunnel.sh --config ./job/hive_2console.conf -e local

2.4 mysql to hive

創(chuàng)建配置文件

dim_basicdate_mysql_2hive.conf

env {
  execution.parallelism = 2
  job.mode = "BATCH"
  checkpoint.interval = 10000
}
source{
    Jdbc {
        url = "jdbc:mysql://hadoop102/dim_db?useUnicode=true&characterEncoding=utf8&useSSL=false"
        driver = "com.mysql.cj.jdbc.Driver"
        connection_check_timeout_sec = 100
        user = "root"
        password = "111111"
        query = "select * from dim_basicdata_date_a_d"
    }
}
sink {
    Hive {
        table_name = "db_hive.dim_basicdata_date_a_d"
        metastore_uri = "thrift://hadoop102:9083"
    }
}

運(yùn)行命令

cd /opt/module/seatunnel-2.3.1
./bin/seatunnel.sh --config ./job/dim_basicdate_mysql_2hive.conf-e local

到此這篇關(guān)于seatunnel 2.3.1全流程部署使用教程的文章就介紹到這了,更多相關(guān)seatunnel 部署使用內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論