首页 > 代码库 > cdh4.1.2 hadoop和oozie集成问题
cdh4.1.2 hadoop和oozie集成问题
1.异常信息例如以下:
Caused by: com.google.protobuf.ServiceException: java.net.ConnectException: Call From slave4/10.95.3.65 to 0.0.0.0:10020 failed on connection exception: java.net.ConnectException: 拒绝连接; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
后来通过调试和跟踪hadoop源码,发现oozie在提交任务后确实会去连接jobhistory,
开到debug模式后,在org.apache.hadoop.mapred.ClientCache,这个类的:
protected MRClientProtocol instantiateHistoryProxy()
throws IOException {
final String serviceAddr = conf.get(JHAdminConfig.MR_HISTORY_ADDRESS);
if (StringUtils.isEmpty(serviceAddr)) {
return null;
}
LOG.debug("Connecting to HistoryServer at: " + serviceAddr);
final YarnRPC rpc = YarnRPC.create(conf);
LOG.debug("Connected to HistoryServer at: " + serviceAddr);
UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
return currentUser.doAs(new PrivilegedAction<MRClientProtocol>() {
@Override
public MRClientProtocol run() {
return (MRClientProtocol) rpc.getProxy(HSClientProtocol.class,
NetUtils.createSocketAddr(serviceAddr), conf);
}
});
}
通过上面的代码能够知道确实连接了HistoryServer,因此我通过命令
mr-jobhistory-daemon.sh start historyserver 把这个服务启动,这样在NN上会启动JobHistoryServer进程,这个进程的监听port就是10020,本以为这样这个问题就能攻克了,没想到在oozie的log日志里还是报上面的错,唯一可能的原因是oozie没有读取到 jobhistory的配置, 因此我把这个配置:
<property>
<name>mapreduce.jobhistory.address</name>
<value>master:10020</value>
</property>
又在oozie/conf/hadoop-conf/core-site.xml文件里又加入了一遍,上述错误就消失了,job也能正常跑起来了。
2. oozie安装好了,提交任务的时候总是报Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Data truncation: Data too long for column ‘proto_action_conf‘ at row 1 {prepstmnt 184665592 INSERT INTO WF_JOBS (id, app_name, app_path, conf, group_name, parent_id, run, user_name, bean_type, auth_token, created_time, end_time, external_id, last_modified_time, log_token, proto_action_conf, sla_xml, start_time, status, wf_instance) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?]} [code=1406, state=22001]
经过搜索,wf_jobs中的proto_action_conf这个字段存储的是工作流中workflow.xml的内容,默认oozie创建元数据表的时候此字段类型为text(mysql),此种类型为最大长度为
65536字符的text列,所以有时无法容纳workflow.xml的内容,须要将其改为LONGTEXT类型,改后就好了。