2017-04-20 72 views
1

我試圖使用sqoop導出將所有記錄從Hive表導出到Sybase表。我不想從HDFS目錄導出到Sybase。 Sybase驅動程序jar已放置在sqoop目錄中。無法從Hive表導出到Sybase

Sqoop命令:

sqoop export \ 
--connect jdbc:sybase:Tds:dbipaddress:0000/DATABASE=omega \ 
--username dummy \ 
--password dummy\ 
--driver com.sybase.jdbc4.jdbc.SybDriver \ 
--table omega_events_sybase \ 
--hcatalog-table demo.omega_events_hive 

雖然這樣做,我得到下面的錯誤

17/04/20 16:44:05 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.5.1 
17/04/20 16:44:05 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead. 
17/04/20 16:44:05 WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time. 
17/04/20 16:44:05 INFO manager.SqlManager: Using default fetchSize of 1000 
17/04/20 16:44:05 INFO tool.CodeGenTool: Beginning code generation 
17/04/20 16:44:06 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM omega_events AS t WHERE 1=0 
17/04/20 16:44:06 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM omega_events AS t WHERE 1=0 
Note: Recompile with -Xlint:deprecation for details. 
17/04/20 16:44:08 INFO mapreduce.ExportJobBase: Beginning export of omega_events 
17/04/20 16:44:09 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar 
17/04/20 16:44:09 INFO mapreduce.ExportJobBase: Configuring HCatalog for export job 
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hive/hcatalog/mapreduce/HCatOutputFormat 
    at org.apache.sqoop.mapreduce.ExportJobBase.runExport(ExportJobBase.java:420) 
    at org.apache.sqoop.manager.SqlManager.exportTable(SqlManager.java:912) 
    at org.apache.sqoop.tool.ExportTool.exportTable(ExportTool.java:81) 
    at org.apache.sqoop.tool.ExportTool.run(ExportTool.java:100) 
    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) 
Caused by: java.lang.ClassNotFoundException: org.apache.hive.hcatalog.mapreduce.HCatOutputFormat 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358) 

有人能幫助我解決這個問題呢?

回答

0

您錯過了HCAT庫。如果Hive已經在執行Sqoop命令的節點中可用。添加這些環境變量,

export HCAT_HOME=$HIVE_HOME/hcatalog 
export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HCAT_HOME/share/hcatalog/* 

否則,請從herehive-hcatalog-core-<version>.jar並將其添加到$SQOOP_HOME/lib/