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ì),支持熱插拔, 帶來(lái)更好的擴(kuò)展性)。
3.簡(jiǎn)單易用(特有的架構(gòu)設(shè)計(jì)下,使得開(kāi)發(fā)配置更簡(jiǎn)單,幾乎零代碼,無(wú)使用成本)。
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è)過(guò)程非常慢…應(yīng)該是從maven中央倉(cāng)庫(kù)下載東西
1.4 補(bǔ)充一些jar包
使用hive的話(huà)需要將這兩個(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放到seatunnel的lib目錄下了。
- 使用
mysql的話(huà)需要將mysql的驅(qū)動(dòng)拷貝過(guò)來(lái),應(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à)會(huì)可以在console看到打印的測(cè)試數(shù)據(jù)
2.2 mysql to console
我新建了一個(gè)用來(lái)放運(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 {
}
}查詢(xún)的是一張日期維表的數(shù)據(jù)
建表語(yǔ)句:
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é)假日類(lèi)型(工作日/法定上班[調(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é)假日類(lèi)型(工作日/法定上班[調(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訪(fǎng)問(wèn)元數(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)文章
MoneyPrinterTurbo 新手小白入門(mén)指南
MoneyPrinterTurbo是一個(gè)開(kāi)源AI短視頻生成工具,通過(guò)輸入主題自動(dòng)生成視頻,包括AI文案、素材匹配、語(yǔ)音合成、字幕生成和背景音樂(lè)添加,提供多種安裝方式,推薦Windows一鍵啟動(dòng)包,常見(jiàn)問(wèn)題包括無(wú)法運(yùn)行、ImageMagick未安裝等,并提供了解決方案2026-04-04
Elasticsearch設(shè)置密碼的方法與驗(yàn)證
在Elasticsearch中設(shè)置密碼是為了保護(hù)您的數(shù)據(jù)安全,下面這篇文章主要給大家介紹了關(guān)于Elasticsearch設(shè)置密碼方法與驗(yàn)證的相關(guān)資料,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下2024-07-07
微信小程序(微信應(yīng)用號(hào))開(kāi)發(fā)工具0.9版安裝詳細(xì)教程
這篇文章主要介紹了微信小程序(微信應(yīng)用號(hào))開(kāi)發(fā)工具0.9版安裝詳細(xì)教程的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-09-09
Prometheus + Grafana 構(gòu)建強(qiáng)大的監(jiān)控和數(shù)據(jù)可視化系統(tǒng)(最新推薦)
Prometheus?是一個(gè)時(shí)間序列數(shù)據(jù)庫(kù),但是,它不僅僅是一個(gè)時(shí)間序列數(shù)據(jù)庫(kù),它涵蓋了可以綁定的整個(gè)生態(tài)系統(tǒng)工具集及其功能,非常適合Kubernetes集群的監(jiān)控,這篇文章主要介紹了Prometheus + Grafana 構(gòu)建強(qiáng)大的監(jiān)控和數(shù)據(jù)可視化系統(tǒng),需要的朋友可以參考下2024-05-05
ClawdBot解決Gateway not reachable錯(cuò)誤的5種方法(保姆級(jí)教學(xué))
ClawdBot是一個(gè)本地運(yùn)行的AI助手,基于vLLM提供高效推理,支持user總結(jié)ClawdBot解決Gatewaynotreachable問(wèn)題步驟,本文給大家介紹ClawdBot保姆級(jí)教學(xué):解決Gateway not reachable錯(cuò)誤的5種方法,感興趣的朋友一起看看吧2026-04-04
C++/QT/Python/MATLAB獲取文件行數(shù)的示例詳解
這篇文章主要為大家學(xué)習(xí)介紹了如何利用C++、QT、Python、MATLAB分別實(shí)現(xiàn)獲取文件行數(shù)的功能,文中的示例代碼講解詳細(xì),需要的可以參考一下2023-08-08
GCC?指令詳解及動(dòng)態(tài)庫(kù)、靜態(tài)庫(kù)的使用方法
GCC?是?Linux?下的編譯工具集,是「GNU?Compiler?Collection」的縮寫(xiě),包含?gcc、g++?等編譯器,這篇文章主要介紹了GCC?指令詳解及動(dòng)態(tài)庫(kù)、靜態(tài)庫(kù)的使用,需要的朋友可以參考下2022-10-10

