Contents
  1. 1. 查看各节点运行任务数
  2. 2. 管理员权限
  3. 3. 普通用户权限
  4. 4. 查看正在运行的任务
  5. 5. 修改任务状态为成功,要进shell
  6. 6. 清理历史工作流
  7. 7. 清除实例记录
  8. 8. 任务统计

各表各字段
https://dolphinscheduler.apache.org/zh-cn/docs/latest/user_doc/metadata-1.3.html

数据库 dolphinscheduler

表名 表信息
t_ds_access_token 访问ds后端的token
t_ds_alert 告警信息
t_ds_alertgroup 告警组
t_ds_command 执行命令
t_ds_datasource 数据源
t_ds_error_command 错误命令
t_ds_process_definition 流程定义
t_ds_process_instance 流程实例
t_ds_project 项目
t_ds_queue 队列
t_ds_relation_datasource_user 用户关联数据源
t_ds_relation_process_instance 子流程
t_ds_relation_project_user 用户关联项目
t_ds_relation_resources_user 用户关联资源
t_ds_relation_udfs_user 用户关联UDF函数
t_ds_relation_user_alertgroup 用户关联告警组
t_ds_resources 资源文件
t_ds_schedules 流程定时调度
t_ds_session 用户登录的session
t_ds_task_instance 任务实例
t_ds_tenant 租户
t_ds_udfs UDF资源
t_ds_user 用户
t_ds_version ds版本信息
t_ds_worker_group
t_ds_worker_server

============================
t_ds_user
+—-+————-+
| id | user_name |
+—-+————-+
| 1 | admin |
| 3 | hcy |
| 5 | jiangmanhua |
| 2 | linlongzhen |
| 4 | liweikang |
| 7 | liwugang |
| 6 | xiaoyuan |
+—-+————-+

修改project归属

select * from t_ds_project;
UPDATE t_ds_project SET user_id=1 where id = 1;

修改 资源 归属

===============================

select * from dolphinscheduler.t_ds_task_instance
select * from dolphinscheduler.t_ds_alert
select * from dolphinscheduler.t_ds_access_token

show tables in dolphinscheduler

告警信息
select * from dolphinscheduler.t_ds_alert where
title not like ‘%succ%’ and create_time like ‘2022-02-20%’ order by create_time desc limit 10

查看各节点运行任务数

select host,state,count(*) from dolphinscheduler.t_ds_task_instance
where state not in (3,5,6,7,8,9,12,13)
group by host,state

管理员权限

update dolphinscheduler.t_ds_user set user_type=0 where user_name=’jiangmanhua’;

普通用户权限

update dolphinscheduler.t_ds_user set user_type=1 where user_name=’jiangmanhua’;

查看正在运行的任务

修改任务状态为成功,要进shell

select id,name,state from dolphinscheduler.t_ds_task_instance where id=11028;

update dolphinscheduler.t_ds_task_instance set state=7 where id=11028;

清理历史工作流

  • 找工作流id
    select * from dolphinscheduler.t_ds_project

// Test项目=1
select id from
dolphinscheduler.t_ds_process_definition
where project_id=1

delete from dolphinscheduler.t_ds_process_instance
where state=7 and command_type=5 and process_definition_id in (
select id from
dolphinscheduler.t_ds_process_definition
where project_id=1)

/**  t_ds_task_instance
 * status:
 * 0 submit success
 * 1 running
 * 2 ready pause
 * 3 pause
 * 4 ready stop
 * 5 stop
 * 6 failure
 * 7 success
 * 8 need fault tolerance
 * 9 kill
 * 10 waiting thread
 * 11 waiting depend node complete
 * 12 delay execution
 * 13 forced success
 */
 

command_type 命令类型:
0 启动工作流,
1 从当前节点开始执行,
2 恢复被容错的工作流,
3 恢复暂停流程,
4 从失败节点开始执行,
5 补数,
6 调度,
7 重跑,
8 暂停,
9 停止,
10 恢复等待线程

清除实例记录

select * from t_ds_process_definition where name=’Check DS Server’ limit 1;
delete from t_ds_process_instance where process_definition_id = 87;

任务统计

dolphinscheduler

t_ds_process_instance
t_ds_task_instance

desc dolphinscheduler.t_ds_process_instance
desc dolphinscheduler.t_ds_task_instance

select id,name,process_definition_id,state,
timediff(end_time,start_time) as time_cost,
host,worker_group
from dolphinscheduler.t_ds_process_instance
where end_time is not null
order by
start_time desc limit 10

==task

select id,name,timediff(end_time,start_time) as time_cost,start_time,end_time,
task_type,process_definition_id,state,
host,worker_group
from dolphinscheduler.t_ds_task_instance
where end_time is not null and
start_time>= “2021-09-01 00:00:00.0” and start_time<”2021-09-15 00:00:00.0”
order by
time_cost desc limit 50

select name,avg

====================
任务执行情况

每天情况:总任务数、任务成功数、任务失败数