通过mapreduce向mysql大量写数据时报错Communications link failure during rollback(). Transaction resolution unknown.:报错
报错如下:
AttemptID:attempt_1398735110766_0055_r_000000_0 Timed out after 600 secs Error: java.io.IOException: Communications link failure during rollback(). Transaction resolution unknown.
at org.apache.hadoop.mapreduce.lib.db.DBOutputFormat$DBRecordWriter.close(DBOutputFormat.java:110)
at org.apache.hadoop.mapred.ReduceTask$NewTrackingRecordWriter.close(ReduceTask.java:550)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:629)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:389)
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:416)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:163)
java代码如下:
import java.io.DataInput; import java.io.DataOutput; import java.io.File; import java.io.IOException; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Iterator;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.filecache