CDH5.X中使用Sqoop导数据报Cannot run program “mysqldump“: error=2, No such file or director

一、背景

CHD5.16环境中,使用sqoop从MySQL中进行ETL导数据到hdfs过程中,报了如下错误:

20/12/22 13:58:48 INFO mapreduce.Job: Task Id : attempt_1607676109057_0133_m_000000_2, Status : FAILED
Error: java.io.IOException: Cannot run program "mysqldump": error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at java.lang.Runtime.exec(Runtime.java:620)
	at java.lang.Runtime.exec(Runtime.java:485)
	at org.apache.sqoop.mapreduce.MySQLDumpMapper.map(MySQLDumpMapper.java:405)
	at org.apache.sqoop.mapreduce.MySQLDumpMapper.map(MySQLDumpMapper.java:49)
	at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:793)
	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
	at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:422)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1924)
	at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.lang.UNIXProcess.forkAndExec(Native Method)
	at java.lang.UNIXProcess.(UNIXProcess.java:248)
	at java.lang.ProcessImpl.start(ProcessImpl.java:134)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 12 more

二、解决方案

①: 从mysql服务器上,拷贝一个mysqldump文件,扔到hadoop主节点nn1的/usr/bin目录下。
②: 从nn1上,将mysqldump文件远程拷贝到其他hadoop节点中。

[root@nn1 bin]# pwd
/opt/cloudera/parcels/CDH-5.16.2-1.cdh5.16.2.p0.8/bin
[root@nn1 bin]# scp /usr/bin/mysqldump dn1:/usr/bin/
mysqldump                                                                                                                                       100%   17MB 201.1MB/s   00:00    
[root@nn1 bin]# scp /usr/bin/mysqldump dn2:/usr/bin/
mysqldump                                                                                                                                       100%   17MB 190.2MB/s   00:00    
[root@nn1 bin]# scp /usr/bin/mysqldump dn3:/usr/bin/
mysqldump                                                                                                                                       100%   17MB 197.6MB/s   00:00    
[root@nn1 bin]# scp /usr/bin/mysqldump dn4:/usr/bin/
mysqldump                                                                                                                                       100%   17MB 176.8MB/s   00:00    
[root@nn1 bin]# scp /usr/bin/mysqldump dn5:/usr/bin/
mysqldump                                                                                                                                       100%   17MB 197.2MB/s   00:00

③:再次实验sqoop语句看是否还有类似报错。

你可能感兴趣的:(hadoop)