[英]import mysql data to hdfs(hadoop 2.4.1) using sqoop(1.4.5)
I am a begineer in Hadoop, trying to import a table from my local database mysql, to hdfs of hadoop 2.4.1 using sqoop 1.4.5. 我是Hadoop的初学者,尝试使用sqoop 1.4.5从本地数据库mysql导入表到hadoop 2.4.1的hdfs。
mysql version : 5.5.38
hdfs version :hadoop 2.4.1
sqoop version :1.4.5
i try sqoop-list-databases ,it give correct answer but then on giving following cmd: 我尝试sqoop-list-databases,它给出正确的答案,但是然后给出以下cmd:
sqoop import --connect jdbc:mysql://localhost:3306/information_schema --username root --password root --table VIEWs -m 1
and i get: 我得到:
ERROR tool.ImportTool: Encountered IOException running import job: java.io.FileNotFoundException: File does not exist: hdfs://localhost:54310/usr/lib/sqoop/lib/jackson-mapper-asl-1.9.13.jar
at org.apache.hadoop.hdfs.DistributedFileSystem$17.doCall(DistributedFileSystem.java:1128)
at org.apache.hadoop.hdfs.DistributedFileSystem$17.doCall(DistributedFileSystem.java:1120)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1120)
at org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.getFileStatus(ClientDistributedCacheManager.java:288)
at org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.getFileStatus(ClientDistributedCacheManager.java:224)
at org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.determineTimestamps(ClientDistributedCacheManager.java:93)
at org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.determineTimestampsAndCacheVisibilities(ClientDistributedCacheManager.java:57)
at org.apache.hadoop.mapreduce.JobSubmitter.copyAndConfigureFiles(JobSubmitter.java:265)
at org.apache.hadoop.mapreduce.JobSubmitter.copyAndConfigureFiles(JobSubmitter.java:301)
at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:389)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1285)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1282)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1556)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1282)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1303)
at org.apache.sqoop.mapreduce.ImportJobBase.doSubmitJob(ImportJobBase.java:186)
at org.apache.sqoop.mapreduce.ImportJobBase.runJob(ImportJobBase.java:159)
at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:247)
at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:665)
at org.apache.sqoop.manager.MySQLManager.importTable(MySQLManager.java:118)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:497)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:601)
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)
Your mapred-site.xml file is configured wrongly. 您的mapred-site.xml文件配置错误。 Check the file content, The content should looks like shown below:
检查文件内容,内容应如下所示:
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
Generally mapred-site.xml file content is made the same as core-site.xml content. 通常,将mapred-site.xml文件的内容与core-site.xml内容相同。 Core-site.xml file content should looks like shown below:
Core-site.xml文件的内容应如下所示:
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://master:54310</value>
</property>
</configuration>
Tayfun YALCINKAYA Tayfun YALCINKAYA
将MySQL驱动程序jar和所有缺少的jar添加到sqoop安装的lib文件夹中,以便能够使用mysql。
Please remove the temp file in HDFS (if some error like /user/hduser/*** is already exists). 请删除HDFS中的临时文件(如果已经存在/ user / hduser / ***之类的错误)。
hadoop fs -mkdir -p /usr/lib/sqoop/
hadoop fs -mkdir -p / usr / lib / sqoop /
hadoop fs -copyFromLocal /usr/lib/sqoop/*.jar /usr/lib/sqoop/lib/
hadoop fs -copyFromLocal /usr/lib/sqoop/*.jar / usr / lib / sqoop / lib /
cp /tmp/sqoop-hduser/compile/* /usr/lib/sqoop/bin/
cp / tmp / sqoop-hduser / compile / * / usr / lib / sqoop / bin /
hadoop fs -put /tmp/sqoop-hduser/compile/* /user/hduser/
hadoop fs -put / tmp / sqoop-hduser / compile / * / user / hduser /
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.