You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

1.新建gbase分区表

CREATE TABLE bj_yw_t_crjrydk_1b (
WYBS varchar(32) NOT NULL,
RYLBDM varchar(2) NOT NULL,
XM varchar(50) NOT NULL,
XBDM varchar(1) NOT NULL,
CRBZ varchar(1) NOT NULL,
GJDQDM varchar(3) NOT NULL,
CSRQ varchar(8) NOT NULL,
ZJLBDM varchar(2) NOT NULL,
ZJHM varchar(20) NOT NULL,
QZZLDM varchar(2) NULL,
CRRQ varchar(8) NOT NULL,
CRSJ varchar(6) NOT NULL,
CRRQSJ varchar(14) NOT NULL,
CRKADM varchar(3) NOT NULL,
JTFSDM varchar(1) NOT NULL,
JTGJBS varchar(32) NULL,
QWGJDQDM varchar(3) NULL,
FZD varchar(4) NULL,
CRJSYDM varchar(1) NOT NULL,
CZY varchar(8) NOT NULL,
TDH varchar(4) NOT NULL,
BMDM varchar(6) NOT NULL,
MZDM varchar(2) NULL,
ZZTDBJ varchar(1) NULL,
QZH varchar(20) NULL,
PJNR varchar(1) NULL,
TLQ varchar(3) NULL,
BGCZY varchar(6) NULL,
BGCZSJ varchar(14) NULL,
HTBLBJ varchar(1) NULL,
PRIMARY KEY (WYBS)
)fragment by round robin 
  in datadbs1,datadbs2,datadbs3,datadbs4

使用轮训分片,将数据分布在 datadbs1,datadbs2,datadbs3,datadbs4 物理表空间中

fragment by round robin 
  in datadbs1,datadbs2,datadbs3,datadbs4

datadbs1 是默认datadbs2,datadbs3,datadbs4手动创建

# root用户
# 进入目录
cd /home/gbase8s_install/gbaseserver_dbs/
# 创建 5GB 大小的文件 (5120 * 1MB = 5GB)
dd if=/dev/zero of=datadbs2 bs=1M count=5120
dd if=/dev/zero of=datadbs3 bs=1M count=5120
dd if=/dev/zero of=datadbs4 bs=1M count=5120
# 设置权限
chown gbasedbt:gbasedbt datadbs2 datadbs3 datadbs4
chmod 660 datadbs2 datadbs3 datadbs4
# 切换gbasedbt用户绑定表空间
# onspaces -c -d <dbspace名> -p <物理文件路径> -o <偏移量> -s <大小(KB)> -k <页大小(KB)>
# 5GB = 5242880 K , 16因为 datadbs1 的页大小是 16384 字节 = 16KB所以我们用 -k 16
onspaces -c -d datadbs2 -p /home/gbase8s_install/gbaseserver_dbs/datadbs2 -o 0 -s 5242880 -k 16
onspaces -c -d datadbs3 -p /home/gbase8s_install/gbaseserver_dbs/datadbs3 -o 0 -s 5242880 -k 16
onspaces -c -d datadbs4 -p /home/gbase8s_install/gbaseserver_dbs/datadbs4 -o 0 -s 5242880 -k 16
# 验证
onstat -d

2.seatunnel 配置及命令

env {
  parallelism = 1
  job.mode = "BATCH"
}
source{
  Doris {
        fenodes = "172.100.40.193:8035"
        query-port = 9035
        username = "admin"
        password = "SU9i4T4Es3DLblbs)-"
        database = "ods"
        table = "bj_yw_t_crjrydk_1b"
  }
}
sink {
  jdbc {
    url = "jdbc:gbasedbt-sqli://172.100.61.61:9088/gbasedb:GBASEDBTSERVER=gbaseserver;DB_LOCALE=zh_CN.utf8;CLIENT_LOCALE=zh_CN.utf8;NEWCODESET=UTF8,utf8,57372"
    # jdbc驱动
    driver = "com.gbasedbt.jdbc.Driver"
    user = "gbasedbt"
    password = "maxvision@999"
    database = "gbasedb"
    table = "bj_yw_t_crjrydk_1b"
    query = "INSERT INTO bj_yw_t_crjrydk_1b (wybs, rylbdm, xm, xbdm, crbz, gjdqdm, csrq, zjlbdm, zjhm, qzzldm,  crrq, crsj, crrqsj, crkadm, jtfsdm, jtgjbs, qwgjdqdm, fzd, crjsydm, czy, tdh, bmdm, mzdm, zztdbj, qzh, pjnr, tlq, bgczy, bgczsj, htblbj) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
    primary_keys = ["WYBS"]
  }
}
cd /home/maxvision/install/seatunnel/bin && ./seatunnel.sh --config /home/maxvision/install/seatunnel/example/doris2gbase-1b.conf -n doris2gbase1b --async