使用sqoop1.4.4从oracle导入数据到hive中错误记录及解决方案
在使用命令导数据过程中,出现如下错误
sqoop import --hive-import --connect jdbc:oracle:thin:@192.168.29.16:1521/testdb --username NAME --passord PASS --verbose -m 1 --table T_USERINFO
错误1:File does not exist: hdfs://opt/sqoop-1.4.4/lib/commons-io-1.4.jar
FileNotFoundException: File does not exist: hdfs://opt/sqoop-1.4.4/lib/commons-io-1.4.jar
at org.apache ... ...
at org.apache ... ...
原因分析:
感谢 Daniel Koverman‘s answer http://stackoverflow.com/questions/19375784/sqoop-jar-files-not-found
It is common for Hadoop services to look for jars in HDFS because all nodes in the cluster can access files in HDFS. This is important if the MapReduce job being kicked off by the Hadoop service, in this case Sqoop, has a dependence on those jars. Remember, the Mappers are running on a DataNode, not the NameNode even though you are (probably) running the Sqoop command from the NameNode. Putting the jars on HDFS is not the only possible solution to this problem, but it is a sensible one.
Now we can deal with the actual error. At least one, but probably all, of your Mappers are unable to find a jar they need. That means that either the jar does not exist or the user trying to access them does not have the required permissions. First check if the file exists by running hadoop fs -ls home/SqoopUser/sqoop-1.4.-cdh4.4.0/sqoop-1.4.-cdh4.4.0.jar by a user with superuser privileges on the cluster. If it does not exist, put it there with hadoop fs -put {jarLocationOn/NameNode/fileSystem/sqoop-1.4.-cdh4.4.0.jar} /home/SqoopUser/sqoop-1.4.-cdh4.4.0/sqoop-1.4.-cdh4.4.0.jar.
解决方法:
将提示中涉及的jar文件put到hdfs文件系统中的相同位置,如果文件系统中没有对应的目录,则需要建立相应目录,在我的错误提示中,由于hdfs://master:8020/中缺少了 /opt/sqoop-1.4.4/lib/文件夹中的各种jar,所以我的做法是把此处整个/opt/sqoop-1.4.4/lib文件夹put到hdfs://master:8020/中
<!--查看以下文件系统中的文件目录,这是递归查询,如果文件很多 建议不要家-R参数,而是逐层查看-->
hadoop fs -ls -R /
<!--建立相同的目录结构-->
hadoop fs -mkdir /opt
hadoop fs -mkdir /opt/sqoop-1.4.
<!--将本地的/opt/sqoop-1.4./lib 拷贝到hdfs中的/opt/sqoop-1.4.4目录中-->
hadoop fs -put /opt/sqoop-1.4./lib /opt/sqoop-1.4./
<!--查看一下结果,确认拷贝成功-->
hadoop fs -ls -R /opt/sqoop-1.4.
错误2 :java.lang.ClassNotFoundException: Class U_BASICINFO not found
对于要导入到hive中的表,错误提示说找不到对应的.class和.jar文件
java.lang.Exception: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class U_BASICINFO not found
at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class U_BASICINFO not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:)
at org.apache.sqoop.mapreduce.db.DBConfiguration.getInputClass(DBConfiguration.java:)
at .....
原因分析:暂时不知道
解决方案:
感谢 user236575’s answer:http://stackoverflow.com/questions/21599785/sqoop-not-able-to-import-table/21626010#21626010
默认sqoop在执行导入table过程中会生成对应的table的java文件和编译产生的.class和.jar文件,.java文件保存在sqoop/bin目录下,而class 和 jar文件则保存在/tmp/sqoop-hduser/compile/ 下相应的文件夹中。
我的解决方式是找到要导入表的class和jar文件,然后将他们拷贝到sqoop/bin目录下面和hdfs文件系统中的/user/USERNAM/ 目录下面(后期测试后,只要将.class和.jar拷贝到sqoop/bin目录下就可以成功import)。
<!--拷贝到sqoop/bin目录下-->
cp /tmp/sqoop-root/compile/某个临时文件夹包含需要的class和jar文件/* /opt/sqoop-1.4.4/bin/ <!--put到hdfs中的/user/USERNAME/文件夹下-->
hadoop fs -put /tmp/sqoop-root/compile/某个临时文件夹包含需要的class和jar文件/* /user/root/
错误3 org.apache.hadoop.mapred.file already exists exception:output directory hdfs://user/root/... ...
解决方案:
在执行过一次导入数据表命令后,当再次执行时,可能会出现这种错误,这是只要进入到hdfs中将对应的文件或者文件夹删除即可。
hadoop fs -rm /user/USERNAME/*
错误4 sqoop导入数据时出现java.sql.SQLException: ORA-01017: invalid username/password; logon denied
原因:oracle 11对大小写敏感,所以需要关掉oracle数据库大小写敏感。
解决方法:
1.登入数据库,执行:alter system set sec_case_sensitive_logon=false
2.或者重新建立一个用户,用全部大写或者小写建立用户名或密码(由于sqoop中密码用户名必须大写,但是最终是按大写还是小写传入数据库的不清楚,所以可能需要尝试大写和小写两种方式后才知道)。
错误5 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 1 time(s)
13/12/14 20:12:07 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/14 20:12:08 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/14 20:12:09 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/14 20:12:10 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/14 20:12:11 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/14 20:12:12 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/14 20:12:13 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/14 20:12:14 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032.
问题原因:hadoop平台可能只启动了dfs没有启动yarn。
解决方法:用start-all.sh启动hadoop或者用start-dfs.sh和start-yarn.sh组合启动hadoop。
使用sqoop1.4.4从oracle导入数据到hive中错误记录及解决方案的更多相关文章
- sqoop1.4.4从oracle导数据到hive中
sqoop从oracle定时增量导入数据到hive 感谢: http://blog.sina.com.cn/s/blog_3fe961ae01019a4l.htmlhttp://f.dataguru. ...
- sqoop 从oracle导数据到hive中,date型数据时分秒截断问题
oracle数据库中Date类型倒入到hive中出现时分秒截断问题解决方案 1.问题描述: 用sqoop将oracle数据表倒入到hive中,oracle中Date型数据会出现时分秒截断问题,只保留了 ...
- sqoop导入数据到hive中元数据问题
简单配置了sqoop之后开始使用,之前用的时候很好用,也不记得有没有启动hivemetastore,今天用的时候没有启动,结果导入数据时,如果使用了db.tablename,就会出现找不到数据库的错, ...
- oracle导入数据
oracle导入数据时候注意点: 1.imp system/admin@oracle9i file=E:\shujukuwenjian\2014-04-01.dmp fromuser=ptb_supe ...
- sqoop工具从oracle导入数据2
sqoop工具从oracle导入数据 sqoop工具是hadoop下连接关系型数据库和Hadoop的桥梁,支持关系型数据库和hive.hdfs,hbase之间数据的相互导入,可以使用全表导入和增量导入 ...
- 使用Sqoop从MySQL导入数据到Hive和HBase 及近期感悟
使用Sqoop从MySQL导入数据到Hive和HBase 及近期感悟 Sqoop 大数据 Hive HBase ETL 使用Sqoop从MySQL导入数据到Hive和HBase 及近期感悟 基础环境 ...
- 教程 | 使用Sqoop从MySQL导入数据到Hive和HBase
基础环境 sqoop:sqoop-1.4.5+cdh5.3.6+78, hive:hive-0.13.1+cdh5.3.6+397, hbase:hbase-0.98.6+cdh5.3.6+115 S ...
- sqoop导oracle数据到hive中并动态分区
静态分区: 在hive中创建表可以使用hql脚本: test.hql USE TEST; CREATE TABLE page_view(viewTime INT, userid BIGINT, pag ...
- 使用sqoop从mysql导入数据到hive
目录 前言 一.使用的导入命令 二.遇到的问题及解决 1. 用文本字段进行分区的问题 2. Hadoop历史服务器Hadoop JobHistory没开启的问题 3. 连接元数据存储数据库报错 4 ...
随机推荐
- 关于ArrayList的一些源码分析
集合是Java中非常重要而且基础的内容,因为任何数据必不可少的就是该数据是如何存储的,集合的作用就是以一定的方式组织.存储数据.这里写的集合,一部分是比较常见的.一部分是不常用但是我个人平时见到过的, ...
- 第三天 ThinkPHP手把手高速拼接站点(三)
6月1日,小雨." 梅子金黄杏子肥,麦花雪白菜花稀. 日长篱落无人过,唯有蜻蜓蛱蝶飞." 七.MVC模式 ThinkPHP的MVC开发机制例如以下: M Model层 模型 ...
- 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:3.安装Oracle RAC-3.1.安装并配置ASM驱动
3.1.安装并配置ASM驱动 3.3.1.检查内核 [root@linuxrac2 etc]# uname -r 2.6.18-164.el5 下载以下rpm包(注意rpm包版本和Linux内核版本一 ...
- Python连接MySQL乱码(中文变问号)
#coding=utf-8 import MySQLdb db = MySQLdb.connect("IP","用户名","密码",&quo ...
- Java Web---登录验证和字符编码过滤器
什么是过滤器? 在Java Web中,过滤器即Filter.Servlet API中提供了一个Filter接口(javax.servlet.Filter).开发web应用时,假设编写的Java类实现了 ...
- Windows正在使用无法停止通用卷怎么办
最后解决方案1: 1.双击任务栏上的安全删除硬件图标 2.按下Ctrl + Alt + Del 组合键调出"任务管理器": 3.结束其中的explorer.exe进程,此时桌面上的 ...
- Digg工程师讲述Digg背后的技术
虽然最近业绩有所下滑,也出现了一些技术故障,但Digg作为首屈一指的社会化新闻网站,其背后的技术还是值得一探,Digg工程师 Dave Beckett 在今年4月份写一篇名为<How Digg ...
- ssh只读事务的管理
概念:从这一点设置的时间点开始(时间点a)到这个事务结束的过程中,其他事务所提交的数据,该事务将看不见!(查询中不会出现别人在时间点a之后提交的数据) 应用场合: 如果你一次执行单条查询语句,则没有必 ...
- java web程序中项目名的更改(http://localhost:8080/)后面的名字
在MyEclipse中的Web项目,如果想另换名称(Context-root)进行发布,可以在项目的属性中进行设置.设置路径如下: 右击项目XX(或选中项目XX,按快捷键Alt+Enter), 打开项 ...
- zh-cn en-uk表示语言(文化)代码与国家地区对照表
af 公用荷兰语 af-ZA 公用荷兰语 - 南非 sq 阿尔巴尼亚 sq-AL 阿尔巴尼亚 -阿尔巴尼亚 ar 阿拉伯语 ar-DZ 阿拉伯语 -阿尔及利亚 ar-BH 阿拉伯语 -巴林 ar-EG ...