我正在尝试使用sqoop export将所有记录从Hive表导出到Sybase表。我不想从HDFS目录导出到Sybase。 Sybase驱动程序jar已放在sqoop目录中。
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 :(得分:0)
您缺少 HCAT
库。如果Hive已在执行Sqoop命令的节点中可用。添加这些环境变量
export HCAT_HOME=$HIVE_HOME/hcatalog
export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HCAT_HOME/share/hcatalog/*
否则,请从here下载hive-hcatalog-core-<version>.jar
并将其添加到$SQOOP_HOME/lib/
。