资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

hadoop数据怎么迁移

本篇内容主要讲解“hadoop数据怎么迁移”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“hadoop数据怎么迁移”吧!

成都创新互联拥有十余年成都网站建设工作经验,为各大企业提供成都网站建设、网站设计服务,对于网页设计、PC网站建设(电脑版网站建设)、成都App定制开发、wap网站建设(手机版网站建设)、程序开发、网站优化(SEO优化)、微网站、申请域名等,凭借多年来在互联网的打拼,我们在互联网网站建设行业积累了很多网站制作、网站设计、网络营销经验,集策划、开发、设计、营销、管理等网站化运作于一体,具备承接各种规模类型的网站建设项目的能力。

tcp工具使用说明:

在表结构/分区创建好的情况下,在hadoop2.0集群的任意一个节点上执行:

hadoop distcp -Dmapreduce.job.queue.name=queue_name  -update -skipcrccheck [source_path...]

1、    source_path参数为hadoop1.0上需要拷贝的表/分区数据目录全路径,必须采用hftp协议访问,如test库下的test表路径为hftp://hadoop1:50070/user/hive/warehouse/test.db/test

2、    target_path参数为hadoop2.0上对应表/分区数据目录路径,如/user/hive/warehouse/test.db/test

3、    跨版本集群拷贝时-update -skipcrccheck参数必须带上。

4、    -Dmapreduce.job.queue.name参数用于指定任务在哪个资源池中运行,如:-Dmapreduce.job.queue.name=queue_0401_01。

5、Distcp任务执行时以MR任务运行,会占用指定资源池中资源。

表数据拷贝示例:

hadoop distcp -Dmapreduce.job.queue.name=queue_0401_01 -update -skipcrccheck hftp://hadoop1:50070/user/hive/warehouse/social.db/sina_wb_timelines  /user/hive/warehouse/social.db/sina_wb_timelines

分区数据拷贝示例:

hadoop distcp -Dmapreduce.job.queue.name=queue_0401_01 -update -skipcrccheck hftp://hadoop1:50070/user/hive/warehouse/social.db/sina_wb_timelines/d=21  /user/hive/warehouse/social.db/sina_wb_timelines/d=21

1、建立表结构:

CREATE  TABLE `fin_fa_wide_asset`(

  `period_name` string,

  `set_of_books_id` string,

  `book_type_code` string,

  `segment1` string,

  `segment2` string,

  `segment3` string,

  `asset_id` string,

  `description` string,

  `asset_category_id` string,

  `asset_number` string,

  `use_department` string,

  `operating_status` string,

  `use_status` string,

  `use_people` string,

  `city` string,

  `location` string,

  `units_assigned` double,

  `date_placed_in_service` string,

  `deprn_run_date` string,

  `cost` double,

  `original_cost` double,

  `salvage_value` double,

  `recoverable_cost` double,

  `current_net_value` double,

  `ytd_deprn` double,

  `deprn_reserve` double,

  `salvage_cost_rate` double,

  `deprn_method_code` string,

  `deprn_in_months` double,

  `life_in_months` double,

  `deprn_amount` double,

  `deprn_adjustment_acct` string,

  `po_number` string,

  `asset_invoice_id` string,

  `invoice_number` string)

PARTITIONED BY (

  `y` string,

  `m` string)row format delimited fields terminated by '\001' stored as rcfile;

2、导数:

hadoop distcp -Dmapreduce.job.queue.name=queue_0009_01 -update -skipcrccheck hftp://hadoop1:50070/user/hive/warehouse/jt_mas_safe.db/fin_fa_wide_asset  /user/hive/warehouse/jt_mas_safe.db/fin_fa_wide_asset

3、加载数据脚本,视不同表分区而定:

alter table jt_mas_safe.fin_fa_wide_asset add partition(y='2015',m='08');

load data inpath '/user/hive/warehouse/jt_mas_safe.db/fin_fa_wide_asset/y=2015/m=08' into table jt_mas_safe.fin_fa_wide_asset partition(y='2015',m='08’);

到此,相信大家对“hadoop数据怎么迁移”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


当前标题:hadoop数据怎么迁移
本文网址:http://cdkjz.cn/article/piedip.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220