1、当时初学Sqoop的时候,mysql导入到hdfs导入命令执行以后,在hdfs上面没有找到对应的数据,今天根据这个bug,顺便解决这个问题吧,之前写的http://www.cnblogs.com/biehongli/p/8039128.html

 1 [hadoop@slaver1 sqoop-1.4.5-cdh5.3.6]$ bin/sqoop import \
2 > --connect jdbc:mysql://slaver1:3306/test \
3 > --username root \
4 > --password 123456 \
5 > --table tb_user \
6 > --m 1
7 Warning: /home/hadoop/soft/sqoop-1.4.5-cdh5.3.6/../hcatalog does not exist! HCatalog jobs will fail.
8 Please set $HCAT_HOME to the root of your HCatalog installation.
9 Warning: /home/hadoop/soft/sqoop-1.4.5-cdh5.3.6/../accumulo does not exist! Accumulo imports will fail.
10 Please set $ACCUMULO_HOME to the root of your Accumulo installation.
11 18/05/18 19:32:51 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5-cdh5.3.6
12 18/05/18 19:32:51 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
13 18/05/18 19:32:51 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
14 18/05/18 19:32:51 INFO tool.CodeGenTool: Beginning code generation
15 18/05/18 19:32:52 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `tb_user` AS t LIMIT 1
16 18/05/18 19:32:52 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `tb_user` AS t LIMIT 1
17 18/05/18 19:32:52 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /home/hadoop/soft/hadoop-2.5.0-cdh5.3.6
18 Note: /tmp/sqoop-hadoop/compile/cb147e9deb144db0034d6f38cb47ad68/tb_user.java uses or overrides a deprecated API.
19 Note: Recompile with -Xlint:deprecation for details.
20 18/05/18 19:33:03 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-hadoop/compile/cb147e9deb144db0034d6f38cb47ad68/tb_user.jar
21 18/05/18 19:33:03 WARN manager.MySQLManager: It looks like you are importing from mysql.
22 18/05/18 19:33:03 WARN manager.MySQLManager: This transfer can be faster! Use the --direct
23 18/05/18 19:33:03 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path.
24 18/05/18 19:33:03 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)
25 18/05/18 19:33:03 INFO mapreduce.ImportJobBase: Beginning import of tb_user
26 18/05/18 19:33:04 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
27 18/05/18 19:33:04 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
28 18/05/18 19:33:07 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
29 18/05/18 19:33:07 INFO client.RMProxy: Connecting to ResourceManager at slaver1/192.168.19.131:8032
30 18/05/18 19:33:08 WARN security.UserGroupInformation: PriviledgedActionException as:hadoop (auth:SIMPLE) cause:org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://slaver1:9000/user/hadoop/tb_user already exists
31 18/05/18 19:33:08 ERROR tool.ImportTool: Encountered IOException running import job: org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://slaver1:9000/user/hadoop/tb_user already exists
32 at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:146)
33 at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:554)
34 at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:430)
35 at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1295)
36 at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1292)
37 at java.security.AccessController.doPrivileged(Native Method)
38 at javax.security.auth.Subject.doAs(Subject.java:415)
39 at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1642)
40 at org.apache.hadoop.mapreduce.Job.submit(Job.java:1292)
41 at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1313)
42 at org.apache.sqoop.mapreduce.ImportJobBase.doSubmitJob(ImportJobBase.java:198)
43 at org.apache.sqoop.mapreduce.ImportJobBase.runJob(ImportJobBase.java:171)
44 at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:268)
45 at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:665)
46 at org.apache.sqoop.manager.MySQLManager.importTable(MySQLManager.java:118)
47 at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:497)
48 at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
49 at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
50 at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
51 at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
52 at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
53 at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
54 at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
55
56 [hadoop@slaver1 sqoop-1.4.5-cdh5.3.6]$

2、报错说以及存在了,hdfs://slaver1:9000/user/hadoop/tb_user already exists,首先根据路径找到了问题,先将这个路径上面的删除了,然后再执行的时候发现将mysql的数据表数据可以导入到hdfs分布式文件系统上面。

1 [hadoop@slaver1 ~]$ hdfs dfs -rm -r /user/hadoop/tb_user
2 18/05/18 19:34:06 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
3 18/05/18 19:34:07 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 0 minutes, Emptier interval = 0 minutes.
4 Deleted /user/hadoop/tb_user
5 [hadoop@slaver1 ~]$

3、执行如下所示:

[hadoop@slaver1 sqoop-1.4.5-cdh5.3.6]$ bin/sqoop import \
> --connect jdbc:mysql://slaver1:3306/test \
> --username root \
> --password 123456 \
> --table tb_user \
> --m 1
Warning: /home/hadoop/soft/sqoop-1.4.5-cdh5.3.6/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/hadoop/soft/sqoop-1.4.5-cdh5.3.6/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
18/05/18 19:39:26 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5-cdh5.3.6
18/05/18 19:39:26 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
18/05/18 19:39:26 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
18/05/18 19:39:26 INFO tool.CodeGenTool: Beginning code generation
18/05/18 19:39:27 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `tb_user` AS t LIMIT 1
18/05/18 19:39:27 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `tb_user` AS t LIMIT 1
18/05/18 19:39:27 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /home/hadoop/soft/hadoop-2.5.0-cdh5.3.6
Note: /tmp/sqoop-hadoop/compile/464d9aff412a6285fd9f6f4c6d16b4e6/tb_user.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
18/05/18 19:39:29 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-hadoop/compile/464d9aff412a6285fd9f6f4c6d16b4e6/tb_user.jar
18/05/18 19:39:29 WARN manager.MySQLManager: It looks like you are importing from mysql.
18/05/18 19:39:29 WARN manager.MySQLManager: This transfer can be faster! Use the --direct
18/05/18 19:39:29 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path.
18/05/18 19:39:29 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)
18/05/18 19:39:29 INFO mapreduce.ImportJobBase: Beginning import of tb_user
18/05/18 19:39:30 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
18/05/18 19:39:30 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
18/05/18 19:39:31 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
18/05/18 19:39:31 INFO client.RMProxy: Connecting to ResourceManager at slaver1/192.168.19.131:8032
18/05/18 19:39:37 INFO db.DBInputFormat: Using read commited transaction isolation
18/05/18 19:39:37 INFO mapreduce.JobSubmitter: number of splits:1
18/05/18 19:39:38 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1526642793183_0001
18/05/18 19:39:39 INFO impl.YarnClientImpl: Submitted application application_1526642793183_0001
18/05/18 19:39:39 INFO mapreduce.Job: The url to track the job: http://slaver1:8088/proxy/application_1526642793183_0001/
18/05/18 19:39:39 INFO mapreduce.Job: Running job: job_1526642793183_0001
18/05/18 19:39:58 INFO mapreduce.Job: Job job_1526642793183_0001 running in uber mode : false
18/05/18 19:39:58 INFO mapreduce.Job: map 0% reduce 0%
18/05/18 19:40:09 INFO mapreduce.Job: map 100% reduce 0%
18/05/18 19:40:09 INFO mapreduce.Job: Job job_1526642793183_0001 completed successfully
18/05/18 19:40:09 INFO mapreduce.Job: Counters: 30
File System Counters
FILE: Number of bytes read=0
FILE: Number of bytes written=132974
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
HDFS: Number of bytes read=87
HDFS: Number of bytes written=153
HDFS: Number of read operations=4
HDFS: Number of large read operations=0
HDFS: Number of write operations=2
Job Counters
Launched map tasks=1
Other local map tasks=1
Total time spent by all maps in occupied slots (ms)=8377
Total time spent by all reduces in occupied slots (ms)=0
Total time spent by all map tasks (ms)=8377
Total vcore-seconds taken by all map tasks=8377
Total megabyte-seconds taken by all map tasks=8578048
Map-Reduce Framework
Map input records=10
Map output records=10
Input split bytes=87
Spilled Records=0
Failed Shuffles=0
Merged Map outputs=0
GC time elapsed (ms)=102
CPU time spent (ms)=1310
Physical memory (bytes) snapshot=102690816
Virtual memory (bytes) snapshot=841768960
Total committed heap usage (bytes)=15794176
File Input Format Counters
Bytes Read=0
File Output Format Counters
Bytes Written=153
18/05/18 19:40:09 INFO mapreduce.ImportJobBase: Transferred 153 bytes in 38.0904 seconds (4.0168 bytes/sec)
18/05/18 19:40:09 INFO mapreduce.ImportJobBase: Retrieved 10 records.
[hadoop@slaver1 sqoop-1.4.5-cdh5.3.6]$

4、数据如下所示:

[hadoop@slaver1 ~]$ hdfs dfs -cat /user/hadoop/tb_user/part-m-00000
18/05/18 19:41:25 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
1,张三,15236083001
2,李四,15236083001
3,王五,15236083001
4,小明,15236083001
5,小红,15236083001
6,小别,15236083001
7,7,7
8,8,8
9,9,9
10,10,10
[hadoop@slaver1 ~]$
 

sqoop错误集锦1的更多相关文章

  1. sqoop错误集锦2

    1.使用sqoop技术将mysql的数据导入到Hive出现的错误如下所示: 第一次使用命令如下所示: 1 [hadoop@slaver1 sqoop-1.4.5-cdh5.3.6]$ bin/sqoo ...

  2. SVN下错误集锦

    SVN下错误集锦 一SVN下的文件被locked不能update和commit 最近做项目的时候,遇到这个问题,SVN下的文件被locked不能update和commit.其提示如下: 解决办法:执行 ...

  3. (转)Hadoop之常见错误集锦

     Hadoop之常见错误集锦            下文中没有特殊说明,环境都是CentOS下Hadoop 2.2.0.1.伪分布模式下执行start-dfs.sh脚本启动HDFS时出现如下错误:   ...

  4. 在Hadoop 2.3上运行C++程序各种疑难杂症(Hadoop Pipes选择、错误集锦、Hadoop2.3编译等)

    首记 感觉Hadoop是一个坑,打着大数据最佳解决方案的旗帜到处坑害良民.记得以前看过一篇文章,说1TB以下的数据就不要用Hadoop了,体现不 出太大的优势,有时候反而会成为累赘.因此Hadoop的 ...

  5. drp错误集锦---“Cannot return from outside a function or method”

    好久都不动的项目,今天打开项目突然是红色感叹号.详细错误表现为: 也就是说,如今MyEclipse已经不识别在JSP页面中使用的return方法了(并且不止一处这种警告),那怎么办?????顿时闹钟一 ...

  6. django 2.0 xadmin 错误集锦

    转载 django 2.0 xadmin 错误集锦 2018-03-26 10:39:18 Snail0Li 阅读数 5188更多 分类专栏: python   1.django2.0把from dj ...

  7. Tensorflow 错误集锦

    文章目录 参考文献 本文记录笔者在Tensorflow使用上的一些错误的集锦,方便后来人迅速查阅解决问题. 我是留白. 我是留白. CreateSession still waiting for re ...

  8. Python:常见错误集锦(持续更新ing)

    初学Python,很容易与各种错误不断的遭遇.通过集锦,可以快速的找到错误的原因和解决方法. 1.IndentationError:expected an indented block 说明此处需要缩 ...

  9. centos7安装mplayer 错误集锦

    (1)在 linux下运行程序时,发现了error while loading shared libraries这种错误,一时间不知道解决办法,在网上搜索,终于解决了:./tests: error w ...

随机推荐

  1. 第一篇 Flask

    第一篇 Flask     一. Python 现阶段三大主流Web框架 Django Tornado Flask 对比 1.Django 主要特点是大而全,集成了很多组件,例如: Models Ad ...

  2. 国内安装helm

    helm repo remove stable helm repo add stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts ...

  3. layer is not defined

    项目中使用layui中,引入新旧版本出现的一个问题. 使用console.log(layer) 打印出来的,显示使用的版本是1.8.0 但是页面中引入的layui有好几个.就是不使用最新的. /*这里 ...

  4. python爬虫系列之初识爬虫

    前言 我们这里主要是利用requests模块和bs4模块进行简单的爬虫的讲解,让大家可以对爬虫有了初步的认识,我们通过爬几个简单网站,让大家循序渐进的掌握爬虫的基础知识,做网络爬虫还是需要基本的前端的 ...

  5. Solidity知识点集 — 溢出和下溢

    合约安全增强: 溢出和下溢 什么是 溢出 (overflow)? 假设我们有一个 uint8, 只能存储8 bit数据.这意味着我们能存储的最大数字就是二进制 11111111 (或者说十进制的 2^ ...

  6. 【转载】SQL Server中的Merge关键字

    简介 原文地址 Merge关键字是一个神奇的DML关键字.它在SQL Server 2008被引入,它能将Insert,Update,Delete简单的并为一句.MSDN对于Merge的解释非常的短小 ...

  7. js实现动态加载脚本的方法实例汇总

      本文实例讲述了js实现动态加载脚本的方法.分享给大家供大家参考,具体如下: 最近公司的前端地图产品需要做一下模块划分,希望用户用到哪一块的功能再加载哪一块的模块,这样可以提高用户体验. 所以到处查 ...

  8. (转)Oracle定时执行计划任务

    Oracle定时执行计划任务 在日常工作中,往往有些事情是需要经常重复地做的,例如每天更新业务报表.每天从数据库中提取符合条件的数据.每天将客户关系管理系统中的数据分配给员工做数据库营销……因此我们就 ...

  9. python、java读数据

    python从txt文档中读数据有个特别神奇的函数 可以把txt文档中的数据直接读取成python数组 java用Scanner类读数据比较方便

  10. 一键脚本清理DEBIAN系统无用组件 减少系统资源

    虽然如今我们选择服务器资源都比较多,以前我们看到很多128MB内存.甚至32MB内存的建站网站,感觉特别羡慕.其实这些也不是难事,相比之下,DEBIAN系统比CENTOS系统占用资源少,然后我们需要进 ...