h-user@h-primary:~/sqoop-1.4.7/bin$ sqoop eval --connect jdbc:mysql://localhost/HADOOP_BANK_DATA_POC --username root --password xxxxxxxx --query "select * from E_INFO"
Warning: /home/h-user/sqoop-1.4.7/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/h-user/sqoop-1.4.7/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/h-user/sqoop-1.4.7/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /home/h-user/sqoop-1.4.7/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
/usr/local/hadoop/libexec/hadoop-functions.sh: line 2366: HADOOP_ORG.APACHE.SQOOP.SQOOP_USER: invalid variable name
/usr/local/hadoop/libexec/hadoop-functions.sh: line 2461: HADOOP_ORG.APACHE.SQOOP.SQOOP_OPTS: invalid variable name
2022-12-23 17:13:06,493 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
2022-12-23 17:13:06,683 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/avro/LogicalType
at org.apache.sqoop.manager.DefaultManagerFactory.accept(DefaultManagerFactory.java:67)
at org.apache.sqoop.ConnFactory.getManager(ConnFactory.java:184)
at org.apache.sqoop.tool.BaseSqoopTool.init(BaseSqoopTool.java:272)
at org.apache.sqoop.tool.EvalSqlTool.run(EvalSqlTool.java:56)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
Caused by: java.lang.ClassNotFoundException: org.apache.avro.LogicalType
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 10 more
h-user@h-primary:~/s
尝试读取mysql表和数据库中的sqoop使用eval时,执行得到上述错误。我尝试了斌以外也,仍然相同的错误。这里出了什么问题?
1条答案
按热度按时间qv7cva1a1#
Sqoop在导入数据时会为表创建Avro模式文件,您需要将Avro JAR文件添加到Sqoop
lib
目录(工具类路径)。顺便说一下,您应该使用
--table E_INFO
而不是--query "select * FROM E_INFO"
参见控制数据格式文档-https://sqoop.apache.org/docs/1.4.7/SqoopUserGuide.html#_purpose
注意:正如前面所回答的,Sqoop是一个退役的Apache项目。建议您找到一个替代工具,该工具将继续维护。