如何使用sqoop import将RDBMS数据导入到特定的hive数据库 [英] How do I import RDBMS data to a specific hive database using sqoop import

查看:173
本文介绍了如何使用sqoop import将RDBMS数据导入到特定的hive数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用sqoop将外部数据库从mysql导入hive。我的要求是使用sqoop import将具有所有表的完整数据库导入到指定的hive数据库。例如,我想导入mysql数据库'hadoop_practice'及其所有表到hive数据库'hadoop_practice'。但是,当我执行以下命令

I need to import external database from mysql into hive using sqoop. My requirements are to import the complete database with all the tables into a specified hive database using sqoop import. for example, I want to import mysql database 'hadoop_practice' along with all its tables to hive database 'hadoop_practice'. However, when I perform the following command

$ sqoop import-all-tables --connect jdbc:mysql:// localhost / hadoop_practice --username root -P - hive-import

$ sqoop import-all-tables --connect jdbc:mysql://localhost/hadoop_practice --username root -P --hive-import

表导入到hive默认数据库中。我尝试登录到hive shell和更改数据库,但它仍然复制到hive中的默认数据库。我知道sqoop提供了复制外部数据库表到hive数据库表,但这将要求我复制一个1000表,通过给每个导入单独的命令选项。我仍然找不到任何选项,它允许我导入所有的表在一个实例。我曾经想过写一个脚本,但有没有任何方式,我可以做到没有写脚本。

the tables are imported into the hive default database. I have tried logging into hive shell and changing the database but it still copies to the default database in hive. I know sqoop provides options of copying external database table into hive database table, but that will require me to copy a 1000 tables by giving separate commands for each import. I still couldn't find any option which allows me to import all the tables in one instance. I have thought about writing a script, but is there any way I can do it without writing the script.

推荐答案

您可以使用--hive-database选项。

You use the --hive-database option.

它在Sqoop版本1.4.4中可用: https://issues.apache.org/jira/browse/SQOOP-912

It was made available in Sqoop version 1.4.4: https://issues.apache.org/jira/browse/SQOOP-912

这篇关于如何使用sqoop import将RDBMS数据导入到特定的hive数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆