DolphinScheduler配置Kerberos,过期重启解决问题(完结)

总结:代码bug导致,修改源码重新编译

解决方法

注意:使用UserGroupInformation.getCurrentUser().hasKerberosCredentials()判断认证是否过期无效

一 只解决worker节点

定位 org.apache.dolphinscheduler.common.utils.HadoopUtils#copyHdfsToLocal

//在使用fs前添加判断是否Kerberos过期
            try {
                this.fs.getFileStatus(new Path("/"));
            } catch (IOException e) {
                logger.warn("当前进程号:" + Thread.currentThread().getId() + "\t测试获取hdfs文件信息失败,更新fs");
                this.fs = getInstance().fs;
            }//源码未改动 定位用
return FileUtil.copy(fs, srcPath, dstPath, deleteSource, fs.getConf());

二 解决所有

org.apache.dolphinscheduler.common.config.StoreConfiguration修改HDFS的对象

    @Bean
    public StorageOperate storageOperate() {
        switch (PropertyUtils.getString(RESOURCE_STORAGE_TYPE)) {
            case STORAGE_S3:
                return S3Utils.getInstance();
            case STORAGE_HDFS:
                HadoopUtils hadoopUtils = HadoopUtils.getInstance();
                hadoopUtils.instanceMonitor();
                return hadoopUtils;
            default:
                return null;
        }
    }

 org.apache.dolphinscheduler.common.utils.HadoopUtils添加方法instanceMonitor

    public void instanceMonitor() {
        logger.warn("创建HadoopUtils实例监控线程...");
        Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(() -> {
            try {
                this.fs.getFileStatus(new Path("/"));
            } catch (IOException e) {
                logger.warn("当前进程号:" + Thread.currentThread().getId() + "\t测试获取hdfs文件信息失败,更新fs");
                this.fs = getInstance().fs;
            }
        }, 3, 1 * 60, TimeUnit.SECONDS);
    }

 只对Bean中的fs定时更新,其他的都是调用getInstance,会自动更新,重新编译后复制到不同模块的lib目录下

问题描述

DolphinScheduler周期性的报错

GSS initiate failed

Caused by: org.ietf.jgss.GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)

执行spark2任务报错,执行shell的spark-submit正常,操作资源管理正常

解决过程

1.下载,搭建DolphinScheduler源码(参见官网)

2.idea远程调试,修改worker-server/bin/start.sh

JAVA_OPTS=后面中添加

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006

3.idea以debug模式启动,模块选择worker-server

问题原因

HadoopUtils的内部虽然有LoadingCache会定时更新,但是fs对象所属的HadoopUtils的实例对象没有定时更新,导致fs一直没有更新,只有每次通过getInstance()获取的才能更新

debug时,alt+u执行fs=getInstance().fs后报错消失

注意,debug时间过长,会导致worker节点掉线,原因zookeeper配置参数时长问题

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值