Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Sqoop2: JDBC Exception "Communications link failure" during import job from mysql to HDFS

Highlighted

Sqoop2: JDBC Exception "Communications link failure" during import job from mysql to HDFS

New Contributor

Folks,

 

I am running and simple import job to transferring data from mysql to HDFS.

My sqoop2-server and mysql DB are running on the same CDH 5.2 VM.

 

My job fails to run 8 out of 10 times with "Connection refused" reason.

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

 

I tried most of the suggestions by googling.

I tried changing the wait_timeout in the mysqld.

 

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
bind-address="127.0.0.1"
wait_timeout = 80
interactive_timeout = 80
connect_timeout = 80

 

And also the JDBC Drive connection parametes from using Hue.

But I still see the connection refused and wait for 0 milliseconds.

 

Is this known error.

Do we know what are the appropriate parameters for JDBC conections and any mysqld configuration.

 

Thanks,

Ajay

 

Error: org.apache.sqoop.common.SqoopException: MAPRED_EXEC_0017:Error occurs during extractor run
  at org.apache.sqoop.job.mr.SqoopMapper.run(SqoopMapper.java:101)
  at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:784)
  at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
  at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
  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:1614)
  at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:163)
  Caused by: org.apache.sqoop.common.SqoopException: GENERIC_JDBC_CONNECTOR_0001:Unable to get a connection
  at org.apache.sqoop.connector.jdbc.GenericJdbcExecutor.<init>(GenericJdbcExecutor.java:51)
  at org.apache.sqoop.connector.jdbc.GenericJdbcImportExtractor.extract(GenericJdbcImportExtractor.java:42)
  at org.apache.sqoop.connector.jdbc.GenericJdbcImportExtractor.extract(GenericJdbcImportExtractor.java:31)
  at org.apache.sqoop.job.mr.SqoopMapper.run(SqoopMapper.java:96)
  ... 7 more
  Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  
  The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
  at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1036)
  at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:338)
  at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2232)
  at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265)
  at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064)
  at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
  at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
  at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395)
  at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
  at java.sql.DriverManager.getConnection(DriverManager.java:571)
  at java.sql.DriverManager.getConnection(DriverManager.java:215)
  at org.apache.sqoop.connector.jdbc.GenericJdbcExecutor.<init>(GenericJdbcExecutor.java:44)
  ... 10 more
  Caused by: java.net.ConnectException: Connection refused
  at java.net.PlainSocketImpl.socketConnect(Native Method)
  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
  at java.net.Socket.connect(Socket.java:579)
  at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:213)
  at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:297)
  ... 25 more

 

 

 

 

 

 

1 REPLY 1

Re: Sqoop2: JDBC Exception "Communications link failure" during import job from mysql to H

Expert Contributor

This seems like a connectivity error between the Sqoop MR job and the database. A few of questions for you:
1. Do you have your database credentials exactly right?
2. Is your database service running?

Don't have an account?
Coming from Hortonworks? Activate your account here