Migrate Hadoop data to Hive

Source: Internet
Author: User
Tags hadoop fs

Because a lot of data is on the Hadoop platform, when migrating data from the hadoop platform to the hive directory, the default delimiter of hive is \, In order to smooth migration, you must specify the data delimiter when creating a table. The syntax is as follows:

Create table test (uid string, name string) row format delimited fields terminated by '\ T ';

In this way, the separator is specified.

Then, use hadoop fs-cp or hadoop distcp to copy folders.

Because the cost of data replication is relatively high and the time is relatively slow, when you do not need to copy data, you can directly move hadoop data to hive, hadoop fs-mv src dest.

A simple method is to directly create an external table. The syntax is as follows:

Create table test (uid string, name string) row format delimited fields terminated by '\ t' location 'hdfs ';

This method avoids time loss caused by data movement and improves the running efficiency.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.