dolphinscheduler 出现 “tenant not exists” 租户不存在的相关问题解决

dolphinscheduler 出现 “tenant not exists” 租户不存在的相关问题解决

问题描述:

在使用dolphinscheduler创建文件夹、上传文件时,出现“租户不存在” ,日志输出:

[INFO] 2021-04-27 14:35:38.513 org.apache.dolphinscheduler.api.controller.ResourcesController:[177] - query resource list, login user:admin, resource type:FILE
[INFO] 2021-04-27 14:35:38.557 org.apache.dolphinscheduler.api.controller.ResourcesController:[293] - query resource list, login user:admin, resource type:, program type:{}

问题排查

单从日志中看不出什么问题,查看配置文件。

# resource.storage.type=HDFS
resource.storage.type=HDFS

# resource store on HDFS/S3 path, resource file will store to this hadoop hdfs path, self configuration, please make sure the directory exists on hdfs and have read write permissions。"/dolphinscheduler" is re
commended
resource.upload.path=/data/dolphinscheduler

# user data local directory path, please make sure the directory exists and have read write permissions
#data.basedir.path=/tmp/dolphinscheduler

# whether kerberos starts
hadoop.security.authentication.startup.state=false

# java.security.krb5.conf.path=/opt/module/dolphinscheduler//conf/krb5.conf
java.security.krb5.conf.path=/opt/module/dolphinscheduler//conf/krb5.conf

# login user from keytab username
login.user.keytab.username=hdfs-mycluster@ESZ.COM

# login user from keytab path
login.user.keytab.path=/opt/module/dolphinscheduler//conf/hdfs.headless.keytab

#resource.view.suffixs
#resource.view.suffixs=txt,log,sh,conf,cfg,py,java,sql,hql,xml,properties

# if resource.storage.type=HDFS
hdfs.root.user=wang

# if resource.storage.type=HDFS
fs.defaultFS=hdfs://192.168.179.10:9000

配置文件也没问题,hdfs 路径也已经是777读写权限,然后从用户admin 入手。

解决思路

通过查看ds源码,资源上传ResourcesService接口:org.apache.dolphinscheduler.api.service.ResourcesService中的getTenantCode

 /**
     * get tenantCode by UserId
     *
     * @param userId user id
     * @param result return result
     * @return
     */
    private String getTenantCode(int userId,Result result){

        User user = userMapper.selectById(userId);
        if (user == null) {
            logger.error("user {} not exists", userId);
            putMsg(result, Status.USER_NOT_EXIST,userId);
            return null;
        }

        Tenant tenant = tenantMapper.queryById(user.getTenantId());
        if (tenant == null){
            logger.error("tenant not exists");
            putMsg(result, Status.TENANT_NOT_EXIST);
            return null;
        }
        return tenant.getTenantCode();
    }

获取租户ID的方法,发现Tenant是通过user.getTenantId() 对应找到的。

Tenant tenant = tenantMapper.queryById(user.getTenantId());

之后赶紧到库中查看:
dolphinscheduler 出现 “tenant not exists” 租户不存在的相关问题解决_第1张图片

发现租户ID 和用户的tenant_id 不对应,直接update :

 update t_ds_user set tenant_id =3 where user_name="admin";

dolphinscheduler 出现 “tenant not exists” 租户不存在的相关问题解决_第2张图片

解决问题!

你可能感兴趣的:(ds调度,调度引擎,大数据)