sqoop csv导入mysql,sqoop导出本地csv到mapreduce上的MySQL错误

I was trying to export a local csv file to MySQL table "test":

$ sqoop export -fs local -jt local --connect jdbc:mysql://172.16.21.64:3306/cf_ae07c762_41a9_4b46_af6c_a29ecb050204 --username username --password password --table test --export-dir file:///home/username/test.csv

However, I got a strange error saying mapreduce.tar.gz not found:

Warning: /usr/hdp/2.5.0.0-1245/hbase does not exist! HBase imports will fail.

Please set $HBASE_HOME to the root of your HBase installation.

Warning: /usr/hdp/2.5.0.0-1245/accumulo does not exist! Accumulo imports will fail.

Please set $ACCUMULO_HOME to the root of your Accumulo installation.

17/04/07 14:22:14 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.5.0.0-1245

17/04/07 14:22:14 WARN fs.FileSystem: "local" is a deprecated filesystem name. Use "file:///" instead.

17/04/07 14:22:14 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.

17/04/07 14:22:15 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.

17/04/07 14:22:15 INFO tool.CodeGenTool: Beginning code generation

17/04/07 14:22:15 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `test2` AS t LIMIT 1

17/04/07 14:22:15 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `test2` AS t LIMIT 1

17/04/07 14:22:15 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/hdp/2.5.0.0-1245/hadoop-mapreduce

Note: /tmp/sqoop-bedrock/compile/009603476b0dfc767b1b94c0607bf6fa/test2.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

17/04/07 14:22:17 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-bedrock/compile/009603476b0dfc767b1b94c0607bf6fa/test2.jar

17/04/07 14:22:17 INFO mapreduce.ExportJobBase: Beginning export of test2

17/04/07 14:22:17 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=

17/04/07 14:22:17 ERROR tool.ExportTool: Encountered IOException running export job: java.io.FileNotFoundException: File file:/hdp/apps/2.5.0.0-1245/mapreduce/mapreduce.tar.gz does not exist

The file is however available at my local machine:

/usr/hdp/2.5.0.0-1245/hadoop/mapreduce.tar.gz

/data/hadoop/yarn/local/filecache/13/mapreduce.tar.gz

Anyone knows what is the issue? I was just following this guide:

解决方案

The property mapreduce.application.framework.path has this value /hdp/apps/2.5.0.0-1245/mapreduce/mapreduce.tar.gz set in mapred-site.xml. This is the path for MapReduce framework archive and points to the file in HDFS.

Here, Sqoop being is triggered with -fs local this property needs to be set with a LocalFS path. Try overriding this property value with the local path of the mapreduce archive file.

$ sqoop export -fs local -jt local -D 'mapreduce.application.framework.path=/usr/hdp/2.5.0.0-1245/hadoop/mapreduce.tar.gz' --connect jdbc:mysql://172.16.21.64:3306/cf_ae07c762_41a9_4b46_af6c_a29ecb050204 --username username --password password --table test --export-dir file:///home/username/test.csv

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值