Sqoop从蜂巢导入蜂巢 [英] Sqoop Import from Hive to Hive

查看:141
本文介绍了Sqoop从蜂巢导入蜂巢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以使用 Sqoop 将表格从Hive DataSource导入Hive DataSource。

查询 - p>

  sqoop import --connect jdbc:hive2:// localhost:10000 / default --driver org.apache.hive.jdbc.HiveDriver --username root --password root --table student1 -m 1 --target-dir hdfs:// localhost:9000 / user / dummy / hive2result 

现在抛出以下异常:

  15/07/19 19: 50:18错误manager.SqlManager:从数据库中读取时出错:java.sql.SQLException:不支持方法
java.sql.SQLException:方法不受支持
位于org.apache.hive.jdbc.HiveResultSetMetaData。 (SqlManager.getColumnInfoForRawQuery(SqlManager.java:290)
at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager。 java:240)
at org.apache.sqoop.manager.SqlManager.getColumnTypes (SqlManager.java:226)
在org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:295)
在org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java :1773)
at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1578)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:96)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:601)
at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop。 Sqoop.runSqoop(Sqoop.java:179)
在org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
在org.apache.sqoop.Sqoop.runTool(Sqoop.java: 227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)


Sqoop不是用于将数据从一个配置单元实例传输到另一个配置单元的工具ve实例。似乎您的要求是将配置单元中的数据从一个群集传输到另一个群集。这可以通过使用hadoop distcp来实现。 sqoop本身的完整形式是SQl toOOP,反之亦然。

如果要将多个数据库和表从一个配置单元迁移到另一个配置单元实例,最好的方法是使用hadoop distcp传输数据并在第二个分区触发DDL蜂巢实例。如果您没有随身携带的DDL,无需担心。
只需转储Metastore数据库。
使用记事本或文本板打开转储文件
用新的hdfs uri替换hdfs uri。
将mysql转储导入第二个配置单元实例的Metastore。
刷新表格。
以下博客文章给出了一个例子:
https://amalgjose.wordpress.com/2013/10/11/migrating-hive-from-one-hadoop-cluster-to-another-cluster-2 /


Can we import tables from Hive DataSource to Hive DataSource using Sqoop.

Query like -

sqoop import --connect jdbc:hive2://localhost:10000/default --driver org.apache.hive.jdbc.HiveDriver --username root --password root --table student1 -m 1 --target-dir hdfs://localhost:9000/user/dummy/hive2result

Right now its throwing the below exception

15/07/19 19:50:18 ERROR manager.SqlManager: Error reading from database: java.sql.SQLException: Method not supported
java.sql.SQLException: Method not supported
    at org.apache.hive.jdbc.HiveResultSetMetaData.isSigned(HiveResultSetMetaData.java:141)
    at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:290)
    at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:240)
    at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:226)
    at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:295)
    at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1773)
    at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1578)
    at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:96)
    at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
    at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:601)
    at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
    at org.apache.sqoop.Sqoop.main(Sqoop.java:236)

解决方案

Sqoop is not a tool for transferring data from one hive instance to another hive instance. Seems like your requirement is to transfer data in hive from one cluster to another cluster. This can be achieved using hadoop distcp. The full form of sqoop itself is SQl to hadOOP and viceversa.

If you want to migrate multiple databases and tables from one hive to another hive instance, the best approach is to transfer the data using hadoop distcp and trigger the DDLs in the 2nd hive instance. If you don't have the DDLs handy with you, no need to worry. Just take a dump of the metastore database. Open the dump file using a notepad or textpad Replace the hdfs uri with the new hdfs uri. Import the mysql dump to the metastore of the 2nd hive instance. Refresh the tables. An example is given in the below blog post https://amalgjose.wordpress.com/2013/10/11/migrating-hive-from-one-hadoop-cluster-to-another-cluster-2/

这篇关于Sqoop从蜂巢导入蜂巢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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