Sqoop import not working


#1

sqoop import
–connect “jdbc:mysql://ip-172-31-20-247/retail_db”
–username sqoopuser
–password NHkkP876rp
–table orders
–compress
–compression-codec org.apache.hadoop.io.compress.SnappyCodec
–target-dir /home/soutam20182163/soutam/
–as-avrodatafile;


Error:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/2.6.5.0-292/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBin
der.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.6.5.0-292/accumulo/lib/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.c
lass]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
19/01/06 17:39:35 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.6.5.0-292
19/01/06 17:39:35 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instea
d.
19/01/06 17:39:35 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
19/01/06 17:39:35 INFO tool.CodeGenTool: Beginning code generation
19/01/06 17:39:36 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM orders AS t LIMIT 1
19/01/06 17:39:36 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM orders AS t LIMIT 1
19/01/06 17:39:36 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/hdp/2.6.5.0-292/hadoop-mapreduce
Note: /tmp/sqoop-soutam20182163/compile/021773ac88c75f6ec1302c385f8a63ae/orders.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
19/01/06 17:39:37 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-soutam20182163/compile/021773ac88c75f6ec1302c3
85f8a63ae/orders.jar
19/01/06 17:39:37 WARN manager.MySQLManager: It looks like you are importing from mysql.
19/01/06 17:39:37 WARN manager.MySQLManager: This transfer can be faster! Use the --direct
19/01/06 17:39:37 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path.
19/01/06 17:39:37 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)
19/01/06 17:39:37 INFO mapreduce.ImportJobBase: Beginning import of orders
19/01/06 17:39:38 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM orders AS t LIMIT 1
19/01/06 17:39:38 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM orders AS t LIMIT 1
19/01/06 17:39:38 INFO mapreduce.DataDrivenImportJob: Writing Avro schema file: /tmp/sqoop-soutam20182163/compile/021773ac
88c75f6ec1302c385f8a63ae/orders.avsc
19/01/06 17:39:39 INFO client.RMProxy: Connecting to ResourceManager at ip-172-31-35-141.ec2.internal/172.31.35.141:8050
19/01/06 17:39:39 INFO client.AHSProxy: Connecting to Application History server at ip-172-31-35-141.ec2.internal/172.31.3
5.141:10200
19/01/06 17:39:41 INFO db.DBInputFormat: Using read commited transaction isolation
19/01/06 17:39:41 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(order_id), MAX(order_id) FROM orders
19/01/06 17:39:41 INFO db.IntegerSplitter: Split size: 17459; Num splits: 4 from: 1 to: 69840
19/01/06 17:39:41 INFO mapreduce.JobSubmitter: number of splits:4
19/01/06 17:39:41 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1545335729280_4854
19/01/06 17:39:42 INFO impl.YarnClientImpl: Submitted application application_1545335729280_4854
19/01/06 17:39:42 INFO mapreduce.Job: The url to track the job: http://ip-172-31-35-141.ec2.internal:8088/proxy/applicatio
n_1545335729280_4854/
19/01/06 17:39:42 INFO mapreduce.Job: Running job: job_1545335729280_4854
19/01/06 17:39:49 INFO mapreduce.Job: Job job_1545335729280_4854 running in uber mode : false
19/01/06 17:39:49 INFO mapreduce.Job: map 0% reduce 0%
19/01/06 17:39:49 INFO mapreduce.Job: Job job_1545335729280_4854 failed with state FAILED due to: Job setup failed : org.a
pache.hadoop.security.AccessControlException: Permission denied: user=soutam20182163, access=WRITE, inode="/home/soutam201
82163/soutam/_temporary/1":hdfs:hdfs:drwxr-xr-x
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:353)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:325)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:246)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:190)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(FSDirectory.java:1950)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(FSDirectory.java:1934)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkAncestorAccess(FSDirectory.java:1917)
at org.apache.hadoop.hdfs.server.namenode.FSDirMkdirOp.mkdirs(FSDirMkdirOp.java:71)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirs(FSNamesystem.java:4185)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.mkdirs(NameNodeRpcServer.java:1109)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.mkdirs(ClientNamenodeProtocolSer
at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(
ClientNamenodeProtocolProtos.java)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:640)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:982)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2351)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2347)
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:1869)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2347)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:106)
at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:73)
at org.apache.hadoop.hdfs.DFSClient.primitiveMkdir(DFSClient.java:3101)
at org.apache.hadoop.hdfs.DFSClient.mkdirs(DFSClient.java:3069)
at org.apache.hadoop.hdfs.DistributedFileSystem$25.doCall(DistributedFileSystem.java:1181)
at org.apache.hadoop.hdfs.DistributedFileSystem$25.doCall(DistributedFileSystem.java:1177)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.mkdirsInternal(DistributedFileSystem.java:1195)
at org.apache.hadoop.hdfs.DistributedFileSystem.mkdirs(DistributedFileSystem.java:1169)
at org.apache.hadoop.fs.FileSystem.mkdirs(FileSystem.java:1925)
at org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter.setupJob(FileOutputCommitter.java:343)
at org.apache.hadoop.mapreduce.v2.app.commit.CommitterEventHandler$EventProcessor.handleJobSetup(CommitterEventHan
dler.java:254)
at org.apache.hadoop.mapreduce.v2.app.commit.CommitterEventHandler$EventProcessor.run(CommitterEventHandler.java:2
34)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.AccessControlException): Permission denied: us
er=soutam20182163, access=WRITE, inode="/home/soutam20182163/soutam/_temporary/1":hdfs:hdfs:drwxr-xr-x
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:353)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:325)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:246)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:190)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(FSDirectory.java:1950)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(FSDirectory.java:1934)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkAncestorAccess(FSDirectory.java:1917)
at org.apache.hadoop.hdfs.server.namenode.FSDirMkdirOp.mkdirs(FSDirMkdirOp.java:71)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirs(FSNamesystem.java:4185)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.mkdirs(NameNodeRpcServer.java:1109)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.mkdirs(ClientNamenodeProtocolSer
verSideTranslatorPB.java:645)
at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(
ClientNamenodeProtocolProtos.java)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:640)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:982)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2351)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2347)
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:1869)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2347)
at org.apache.hadoop.ipc.Client.getRpcResponse(Client.java:1554)
at org.apache.hadoop.ipc.Client.call(Client.java:1498)
at org.apache.hadoop.ipc.Client.call(Client.java:1398)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:233)
at com.sun.proxy.$Proxy10.mkdirs(Unknown Source)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.mkdirs(ClientNamenodeProtocolTranslatorPB.
java:610)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:290)
19/01/06 17:39:49 INFO mapreduce.Job: Counters: 2
Job Counters
Total time spent by all maps in occupied slots (ms)=0
Total time spent by all reduces in occupied slots (ms)=0
19/01/06 17:39:49 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSys
temCounter instead
19/01/06 17:39:49 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 10.6056 seconds (0 bytes/sec)
19/01/06 17:39:49 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoo
p.mapreduce.TaskCounter instead
19/01/06 17:39:49 INFO mapreduce.ImportJobBase: Retrieved 0 records.
19/01/06 17:39:49 ERROR tool.ImportTool: Error during import: Import job failed!


#2

Try using this command.

sqoop import --Dmapreduce.job.user.classpath.first=true
–connect “jdbc:mysql://ip-172-31-20-247/retail_db”
–username sqoopuser
–password NHkkP876rp
–table orders
–compress
–compression-codec org.apache.hadoop.io.compress.SnappyCodec
–target-dir /home/soutam20182163/soutam/
–as-avrodatafile;


#3

The target directory should be a path pointing to a location in HDFS. Your home directory in HDFS would be of the form: /user/soutam20182163/soutam/