hive数据的导入和导出

  • 常用于数据迁移场景
  • 出数据库,可导出所有数据和源数据

使用EXPORT导出数据

格式:
export table employee to '/data/output';

export table employee_partitioned partition(year=2020,month=6) to '/tmp/output';

示:
mysql和hive数据的导入导出

使用IMPORT导入数据

import table employee from '/tmp/ouput';

import table employee_partitioned partition(year=2020,month=6) from '/tmp/output'

mysql数据的导入和导出

导出

mysqldump -uroot -pok mydemo customs > /opt/test
ok为数据库密码,mydemo为库名,customs为表名,/opt/test为路径

示:
mysql和hive数据的导入导出

导入

mysql -uroot -pok input < /opt/test

示:
mysql和hive数据的导入导出

相关文章: