自建Hadoop迁移阿里云MaxCompute实践-持续更新2018/9/13

Hadoop迁移MaxCompute的文章教程应该不少,比如前不久刚刚发布的

《Hadoop数据迁移到MaxCompute最佳实践》https://help.aliyun.com/video_detail/88429.html  

理论与实践:如何从Hadoop迁移到MaxCompute https://yq.aliyun.com/articles/639294

https://yq.aliyun.com/articles/637482


但用户实际迁移还是会遇到一些问题,我会定期整理一些数据迁移和脚本迁移遇到的问题及解决方案,帮助企业快速拥有阿里巴巴同款数据仓库,构建自己的数据中台,并开展数据业务;


网络问题:

1、自建机房如何连通阿里云MaxCompute

方案:通过物理专线访问VPC中的云服务  https://help.aliyun.com/document_detail/57195.html


2、MaxCompute 经典网络和VPC访问配置

方案:参考 https://help.aliyun.com/document_detail/34951.html

Region名称所在城市开服状态VPC网络EndpointVPC网络Tunnel Endpoint
华东1杭州已开服http://service.cn.maxcompute.aliyun-inc.com/apihttp://dt.cn-hangzhou.maxcompute.aliyun-inc.com
华东2上海已开服http://service.cn.maxcompute.aliyun-inc.com/apihttp://dt.cn-shanghai.maxcompute.aliyun-inc.com
华北2北京已开服http://service.cn.maxcompute.aliyun-inc.com/apihttp://dt.cn-beijing.maxcompute.aliyun-inc.com

3、数据同步慢

方案:建议走VPC专线和经典网络,公网比较慢;另外,如果通过tunnel上传,命令行添加参数 -threads 10 ,数据切片;


数据同步问题:

1、 HDFS-MaxCompute 

方案:自己部署DataX或使用阿里云数据集成(官方版本DataX),DataX还支持DataX-On-Hadoop(提工单申请)

https://yq.aliyun.com/articles/638606

https://help.aliyun.com/document_detail/47677.html


2、同步数据时分区字段里面有月份需要截取

方案:shell+datax自定义资源组(除华东2提工单),在shell中对月份进行处理,如/user/hive/ods/hivetable/op_year=2018/op_month=8/op_day=1



任务迁移问题:

1、每天几百个任务如何批量导入?

方案:使用Dataworks任务同步工具(内测,提工单)


SQL问题:


1、Hadoop库如何映射MaxCompute

方案:简单的话是一对一,或者可以按照合适的纬度(比如业务部门)重新划分整合后再对应到Dataworks/MaxCompute的多个projects,这样方便后续管理。


2、字段类型

兼容date类型

方案:date类型需要set odps.sql.type.system.odps2=true;set odps.sql.hive.compatible=true;

其他需要set flag的字段类型参考https://help.aliyun.com/document_detail/27821.html


3、系统参数

兼容CURRENT_TIMESTAMP

方案:set odps.sql.type.system.odps2=true;set odps.sql.hive.compatible=true;


兼容${hiveconf:ymd}

方案:替换成${bdp.system.bizdate}



4、函数

兼容to_date(SUBSTR('2018-08-24 16:58:21.284',1,10),'yyyy-mm-dd')

方案:需要改写,select cast(cast('2018-08-24 16:58:21.284' as timestamp) as date); 



兼容from_unixtime(unix_timestamp(cast(ds as string),'yyyymmdd'),'yyyy-mm-dd')

方案:ds是date类型,需要set odps.sql.type.system.odps2=true;set odps.sql.hive.compatible=true;


grouping sets/rollup/cube

方案:MaxCompute近期开放


5、表达式

兼容字段值为null时比较大小

方案:set odps.sql.type.system.odps2=true;set odps.sql.hive.compatible=true;


兼容string 与 数值类型直接关联

方案:set odps.sql.type.system.odps2=true;set odps.sql.hive.compatible=true;


兼容map() cnt

方案:null as cnt


插入动态分区数据为空,INSERT OVERWRITE TABLE ods_log partition (ymd) select 20180910 as ymd from ods_log

方案:套一层select,20180910 as ymd 是个常量,会被当成静态分区来处理,改写为INSERT OVERWRITE TABLE ods_log partition (ymd) select * from (select 20180910 as ymd from ods_log) t


DML、DDL区别

方案:https://help.aliyun.com/document_detail/54051.html


与Hive数据类型映射表

参考:https://help.aliyun.com/document_detail/54081.html


相关问题:

1、如何连接Tableau和BDP、QuickBI

方案:通过MaxCompute Lightning (公测),走PostgreSql协议;



未完待续...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值