When working with Hive, sometimes we need to migrate data among different environments. Or we may need to back up some data. Since Hive 0.8.0,
IMPORT statements are available to support the import and export of data in HDFS for data migration or backup/restore purposes.
EXPORT statement will export both data and metadata from a table or partition. Metadata is exported in a file called
_metadata. Data is exported in a subdirectory called data:
jdbc:hive2://> EXPORT TABLE employee TO '/user/dayongd/output3'; No rows affected (0.19 seconds)
EXPORT, we can manually copy the exported files to other Hive instances or use Hadoop
distcp commands to copy to other HDFS clusters. Then, we can import the ...