最后重启azkaban的exec-server和web-server,重新运行job就好了。
如果上述修改后,不起作用,直接修改azkaban的源码,然后重新编译
进入azkaban源码目录:
azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
如果不知道ProcessJob.java的位置,使用 find 命令查找
$ find -name 'ProcessJob.java'
找到下面的代码
红色框中的内容就是我们运行job失败后,在控制台看到的日志,修改144和155行代码中的true为false
修改前:
if (this.sysProps.getBoolean(MEMCHECK_ENABLED, true) && this.jobProps.getBoolean(AZKABAN_MEMORY_CHECK, true))
修改后:
if (this.sysProps.getBoolean(MEMCHECK_ENABLED, false) && this.jobProps.getBoolean(AZKABAN_MEMORY_CHECK, false))
重新编译Azkaban,编译完成后
将azkaban/azkaban-exec-server/build/distributions目录下的azkaban-exec-server-3.48.0-8-gdc851ec.tar.gz 解压重命名,然后再修改配置替换旧的azkaban-exec-server,最后重启exec和web服务即可
将下图代码中的true修改为false,然后重新编译,编译完成后,将azkaban/azkaban-exec-server/build/distributions目录下的azkaban-exec-server-3.48.0-8-gdc851ec.tar.gz 解压重命名,然后再修改配置替换旧的azkaban-exec-server,最后重启exec和web服务即可
如果不想编译,就修改commonprivate.properties文件中azkaban.native.lib为false
azkaban.native.lib=false
azkaban打开execute as user,使用azkaban用户执行调度任务时报错
java.lang.RuntimeException: Not permitted to proxy as 'azkaban' through Azkaban
at azkaban.jobExecutor.ProcessJob.run(ProcessJob.java:240)
at azkaban.execapp.JobRunner.runJob(JobRunner.java:784)
at azkaban.execapp.JobRunner.doRun(JobRunner.java:600)
at azkaban.execapp.JobRunner.run(JobRunner.java:561)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
打开azkaban.jobExecutor.ProcessJob类,搜索Not permitted to proxy
if (isExecuteAsUser) {
final String nativeLibFolder = this.sysProps.getString(AZKABAN_SERVER_NATIVE_LIB_FOLDER);
executeAsUserBinaryPath = String.format("%s/%s", nativeLibFolder, "execute-as-user");
effectiveUser = getEffectiveUser(this.jobProps);
// Throw exception if Azkaban tries to run flow as a prohibited user
if (blackListedUsers.contains(effectiveUser)) {
throw new RuntimeException(
String.format("Not permitted to proxy as '%s' through Azkaban", effectiveUser)
);
}
可见当尝试使用禁用用户执行任务时azkaban会抛出异常。往上寻找blackListedUsers是什么
//Get list of users we never execute flows as. (ie: root, azkaban)
final Set blackListedUsers = new HashSet<>(
Arrays.asList(
this.sysProps.getString(Constants.ConfigurationKeys.BLACK_LISTED_USERS, "root,azkaban")
.split(",")
)
);
blackListedUsers包含root,azkaban用户,所以当开启execute as user的时候,blackListedUsers包含的用户都是禁止执行flow的。
解决:关掉execute-as-user即可,azkaban-exec-server中/home/hadoop/software/azkaban/azkaban-exec-server/plugins/jobtypes/commonprivate.properties添加如下配置
execute.as.user=false