如何创建Doris数据表和Doris ROUTINE LOAD

第一步:切换用户

su - doris

第二步:登录至目标服务器

mysql -h 10.68.90.11 -P 39030

第三步:选择要操作的目标数据库

use tonly_data

第四步:创建数据表

CREATE TABLE `test_tonly_location`
(
  `upload_time` datetime NULL COMMENT "",
  `vin` varchar(32) NULL COMMENT "",
  `tbox_vin` varchar(32) NULL COMMENT "",
  `gps_x` float NULL COMMENT "",
  `gps_y` float NULL COMMENT "",
  `bd_x` float NULL COMMENT "",
  `bd_y` float NULL COMMENT "",
  `speed` int(11) NULL COMMENT "",
  `angle` int(11) NULL COMMENT "",
  `quadrant` int(11) NULL COMMENT "",
  `altitude` int(11) NULL COMMENT "",
  `cgq_x` float NULL COMMENT "",
  `cgq_y` float NULL COMMENT "",
  `cgq_z` float NULL COMMENT "",
  `source_table` datetime NULL COMMENT ""
) ENGINE = OLAP DUPLICATE KEY(`upload_time`, `vin`)
PARTITION BY RANGE(`upload_time`)
(
START ("2023-08-25") END ("2023-09-05") EVERY (INTERVAL 1 day)
)
DISTRIBUTED BY HASH(`vin`) BUCKETS 32
PROPERTIES (
"replication_num" = "2",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-100",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "32",
"in_memory" = "false",
"storage_format" = "DEFAULT"
);

第五步:创建Doris ROUTINE LOAD

CREATE
ROUTINE LOAD
from_kafka_test_tonly_location ON test_tonly_location
COLUMNS TERMINATED BY ",",
COLUMNS (upload_time,
vin,
tbox_vin,
gps_x,
gps_y,
bd_x,
bd_y,
speed,
angle,
quadrant,
altitude,
cgq_x,
cgq_y,
cgq_z,
source_table)
PROPERTIES
(
    "desired_concurrent_number"="3",
    "max_error_number"="1000",
    "max_batch_interval"="60",
    "max_batch_rows"="200000"
)
FROM KAFKA
(
    "kafka_broker_list"= "10.68.90.11:9092,10.68.90.12:9092,10.68.90.13:9092",
    "kafka_topic" = "test_tonly_location",
    "property.group.id" = "test_tonly_location_group"
);

第六步:查看数据装入任务

show routine load;

show routine load for from_kafka_test_tonly_location \G

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值