dolphinscheduler的僵尸任务清理

原因:海豚调度中有几百条僵尸任务, 界面怎么也删不掉,想从数据库中删除,开始查找从数据库删除的办法。

参考以下脚本,结合我库中僵尸任务的特征,用end_time is null删除了大半。
– 删除 任务实力中运行的任务
select * from t_ds_process_instance where end_time is null and command_type=9

实在找不到特征的,就按名字删除了。

– 删除 任务实力中运行的任务
select * from t_ds_process_instance where end_time is null and command_type=9 – state=6 end_time is null

#删除工作流实例
select * from t_ds_process_instance where DATE_FORMAT(start_time ,“%Y-%m-%d”) = ‘2021-06-23’;

delete from t_ds_process_instance where DATE_FORMAT(start_time ,“%Y-%m-%d”) = ‘2021-06-23’ and state = ‘1’;

#删除工作流
select * from t_ds_process_definition where DATE_FORMAT(create_time ,“%Y-%m-%d”) = ‘2021-06-23’;

delete from t_ds_process_definition where DATE_FORMAT(create_time,“%Y-%m-%d”) = ‘2021-06-23’;

#删除任务和历史任务
select * from dk_hc_task ;

delete from dk_hc_task ;

#历史任务
select * from dk_hc_history_log ;

delete from dk_hc_history_log ;

#删除节点
select * from dk_hc_workflow ;

delete from dk_hc_workflow ;

#删除节点承载的目录
select * from dk_hc_workflow_folder ;

delete from dk_hc_workflow_folder where title !=‘根目录’;

INSERT INTO dk_hc_workflow_folder
(id, title, wf_id, create_time, create_user, update_time, update_user, parent_id, type, expand, contextmenu, project_id, edit_user, flowType)
VALUES(1, ‘根目录’, NULL, ‘2021-02-02 15:51:29.0’, 1, NULL, 1, 0, 1, 1, 1, 0, 1, NULL);

#删除临时表
select * from t_ds_command ;

delete from t_ds_command ;

delete from t_ds_error_command ;

#清除数据源
select * from t_ds_datasource ;

delete from t_ds_datasource where name != ‘192.168.111.222’ ;

#---------------------------------------工作空间管理----------------------------------------------------------

#删除租户
select * from t_ds_tenant where tenant_code != ‘root’;

delete from t_ds_tenant where tenant_code != ‘root’;

#删除用户
select * from t_ds_user where user_name != ‘admin’;

delete from t_ds_user where user_name != ‘admin’;

#删除worker分组,default不在数据之内
select * from t_ds_worker_group ;

delete from t_ds_worker_group;

#删除警告邮件地址
select * from t_ds_alertgroup ;

delete from t_ds_alertgroup;

#删除令牌
select * from t_ds_access_token ;

delete from t_ds_access_token;

#删除队列
select * from t_ds_queue where queue_name !=‘default’;

delete from t_ds_queue where queue_name !=‘default’;

#删除项目空间

select * from t_ds_project ;

delete from t_ds_project where name !=‘临时调度’;

#清除datax的记录
select * from dk_datax_statistics ;

delete from dk_datax_statistics;

 

posted @ 2023-02-01 14:16  玩转大数据  阅读(395)  评论(0编辑  收藏  举报