我已在其他服务器上尝试过此代码。我有两个具有相同配置的hbase,hadoop和其他服务器。批量加载在一台服务器上获得成功,并在另一台服务器上引发错误。
代码:
Connection conn = ConnectionFactory.createConnection(config);
TableName tableName = TableName.valueOf(config.get("custom.table.name"));
Table table = conn.getTable(tableName);
RegionLocator regionLocator = conn.getRegionLocator(tableName);
HFileOutputFormat2.configureIncrementalLoad(job, table, regionLocator);
HTable hTable = new HTable(config, config.get("custom.table.name"));
FileInputFormat.addInputPath(job, new Path(inputPath));
FileOutputFormat.setOutputPath(job, new Path(outputPath));
// returns 0 when job went on fine, 1-when there is any error.
boolean jobstatus = job.waitForCompletion(true);
FsShell shell = new FsShell(config);
try {
shell.run(new String[] { "-chmod", "-R", "777", outputPath });
} catch (Exception e) {
logger.error("Could not change the file permissions ", e);
throw e;
}
if (conn instanceof ClusterConnection) {
if (((ClusterConnection) conn).isManaged()) {
throw new NeedUnmanagedConnectionException();
}
}
if (jobstatus) {
// uploading Hfiles into Hbase
LoadIncrementalHFiles loader = new LoadIncrementalHFiles(config);
loader.doBulkLoad(new Path(outputPath), hTable);
hTable.close();
table.close();
conn.close();
// Write job log into HDFS
}
错误:工作流操作切换回运行并被终止。我终于在错误下面得到了这个
Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.JavaMain], main() threw exception, java.io.IOException: Retry attempted 10 times without completing, bailing out
org.apache.oozie.action.hadoop.JavaMainException: java.io.IOException: Retry attempted 10 times without completing, bailing out
at org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:59)
at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:75)
at org.apache.oozie.action.hadoop.JavaMain.main(JavaMain.java:35)
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.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:231)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:453)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:170)
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.mapred.YarnChild.main(YarnChild.java:164)
Caused by: java.io.IOException: Retry attempted 10 times without completing, bailing out
at org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles.doBulkLoad(LoadIncrementalHFiles.java:408)
at org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles.doBulkLoad(LoadIncrementalHFiles.java:313)
at com.boeing.ecfdda.dataprocessor.jobs.BulkloadJob.main(BulkloadJob.java:148)
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.oozie.action.hadoop.JavaMain.run(JavaMain.java:56)
... 15 more
Oozie Launcher failed, finishing Hadoop job gracefully