持续创作,加速成长!这是我参与「掘金日新计划 · 6 月更文挑战」的第6天,点击查看活动详情
其他导入案例参考
- 将本地文件'testData'中的数据导入到数据库'testDb'中'testTbl'的表,使用Label用于去重
| curl **--**location-trusted -u root **-**H "label:123" -T testData http :// host : port / api / testDb / testTbl / _stream_load |
|---|
- 将本地文件'testData'中的数据导入到数据库'testDb'中'testTbl'的表,使用Label用于去重, 并且只导入k1等于20180601的数据
| curl **--**location-trusted -u root **-**H "label:123" **-**H "where: k1=20180601" -T testData http :// host : port / api / testDb / testTbl / _stream_load |
|---|
- 将本地文件'testData'中的数据导入到数据库'testDb'中'testTbl'的表, 允许20%的错误率(用户是defalut_cluster中的)
| curl **--**location-trusted -u root **-**H "label:123" **-**H "max_filter_ratio:0.2" -T testData http :// host : port / api / testDb / testTbl / _stream_load |
|---|
- 将本地文件'testData'中的数据导入到数据库'testDb'中'testTbl'的表, 允许20%的错误率,并且指定文件的列名(用户是defalut_cluster中的)
| curl **--**location-trusted -u root **-**H "label:123" **-**H "max_filter_ratio:0.2" **-**H "columns: k2, k1, v1" -T testData http :// host : port / api / testDb / testTbl / _stream_load |
|---|
- 将本地文件'testData'中的数据导入到数据库'testDb'中'testTbl'的表中的p1, p2分区, 允许20%的错误率。
| curl **--**location-trusted -u root **-**H "label:123" **-**H "max_filter_ratio:0.2" **-**H "partitions: p1, p2" -T testData http :// host : port / api / testDb / testTbl / _stream_load |
|---|
- 使用streaming方式导入(用户是defalut_cluster中的)
| seq 1 10 | awk '{OFS="\t"}{print 1 * 10}' | curl **--**location-trusted -u root -T - http :// host : port / api / testDb / testTbl / _stream_load | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
- 导入含有HLL列的表,可以是表中的列或者数据中的列用于生成HLL列
| curl **--**location-trusted -u root **-**H "columns: k1, k2, v1=hll_hash(k1)" -T testData http :// host : port / api / testDb / testTbl / _stream_load |
|---|
Routine Load
例行导入功能为用户提供了义中自动从指定数据源进行数据导入的功能
适用场景
当前仅支持kafka系统进行例行导入。
使用限制
-
支持无认证的 Kafka 访问,以及通过 SSL 方式认证的 Kafka 集群。
-
支持的消息格式为 csv 文本格式。每一个 message 为一行,且行尾不包含换行符。
-
仅支持 Kafka 0.10.0.0(含) 以上版本。
基本原理
如上图,Client 向 FE 提交一个例行导入作业。
FE 通过 JobScheduler 将一个导入作业拆分成若干个 Task。每个 Task 负责导入指定的一部分数据。Task 被 TaskScheduler 分配到指定的 BE 上执行。
在 BE 上,一个 Task 被视为一个普通的导入任务,通过 Stream Load 的导入机制进行导入。导入完成后,向 FE 汇报。
FE 中的 JobScheduler 根据汇报结果,继续生成后续新的 Task,或者对失败的 Task 进行重试。
整个例行导入作业通过不断的产生新的 Task,来完成数据不间断的导入。