将对象存储中的数据导入Es

阿里云知识 阿里云知识 3年前 (2020-03-14) 134次浏览 0个评论 扫描二维码

上传数据到阿里云对象存储

登录管理控制台,进入阿里云对象存储产品界面,创建bucket并上传测试文件:

创建阿里云对象存储 Source

进入BSC编辑作业界面,创建bos source table, sql代码如下

CREATE table source_table_bos( stringtype STRING, longtype LONG) with( type = '阿里云对象存储', path = 'bos://es-sink-test/test', encode = 'json');

其中path为上图中红框中指定的bos路径,并在路径前增加"bos://"前缀。

创建Es Sink Table

sql代码如下

create table sink_table_es( stringtype String, longtype Long)with( type = 'ES', es.net.http.auth.user = 'superuser', es.net.http.auth.pass = 'bbs_2016', es.resource = 'bsc_test_2/doc_type', es.clusterId = '296245916518715392', es.region = 'bd', es.port = '8200', es.version = '6.5.3');

其中:

  • es.resource对应es的索引与类型,es会在bsc写入数据时自动创建指定索引
  • es.clusterId对应es的集群ID
  • es.region 表示 Es服务所在的地区的代码,可以参考 Es服务区域代码 中查询区域与代码的对应关系。

编写导入语句

sql语句如下:

insert intosink_table_es(stringtype, longtype) outputmode appendselect stringtype, longtypefrom source_table_bos;

保存作业并发布运行作业

喜欢 (0)
阿里云最新优惠活动,点击查看
腾讯云最新优惠活动,点击查看
腾讯云香港及海外免备案服务器优惠活动,点击查看
华为云服务器本周优惠活动,点击查看

文章评论已关闭!