需求背景:
为避免工作流单机故障,需要让工作流flowable支持集群数据库
版本信息:MySQL集群版本:8.0.22-cluster flowable版本:6.5.0.6
1、工作流里建库脚本里有varchar(4000)的字段,ndbcluster引擎中varchar长度总和最大支持varchar(7497),需要更改所有脚本里varchar(4000)的长度总和不能超过7497
2、工作流里新建表指定引擎为InnoDB,需要手动用脚本修改为ndbcluster
3、有外键约束的,先删除外键
查找外键约束的方法:select * from INFORMATION_SCHEMA.KEY_COLUMN_USAGE
where TABLE_SCHEMA = 'flowable'
AND REFERENCED_TABLE_NAME != ''
and referenced_table_name = 'act_id_group'
4、表与表之间不同的引擎,不能建立外键关系 报错信息:1824 - Failed to open the referenced table 'act_id_group'
5、外键约束ndbcluster不支持的应用场景有级联操作
执行脚本如下:
-- 删除外键约束act_id_membership
ALTER TABLE `flowable`.`act_id_membership` DROP FOREIGN KEY `ACT_FK_MEMB_GROUP`;
-- 删除外键约束act_ru_event_subscr
ALTER TABLE `flowable`.`act_id_membership` DROP FOREIGN KEY `ACT_FK_MEMB_USER`;
ALTER TABLE `flowable`.`act_id_priv_mapping` DROP FOREIGN KEY `ACT_FK_PRIV_MAPPING`;
ALTER TABLE `flowable`.`act_procdef_info` DROP FOREIGN KEY `ACT_FK_INFO_JSON_BA`;
ALTER TABLE `flowable`.`act_procdef_info` DROP FOREIGN KEY `ACT_FK_INFO_PROCDEF`;
ALTER TABLE `flowable`.`act_ge_bytearray` DROP FOREIGN KEY `ACT_FK_BYTEARR_DEPL`;
ALTER TABLE `flowable`.`act_re_model` DROP FOREIGN KEY `ACT_FK_MODEL_DEPLOYMENT`;
ALTER TABLE `flowable`.`act_re_model` DROP FOREIGN KEY `ACT_FK_MODEL_SOURCE`;
ALTER TABLE `flowable`.`act_re_model` DROP FOREIGN KEY `ACT_FK_MODEL_SOURCE_EXTRA`;
ALTER TABLE `flowable`.`act_ru_task` DROP FOREIGN KEY `ACT_FK_TASK_EXE`;
ALTER TABLE `flowable`.`act_ru_task` DROP FOREIGN KEY `ACT_FK_TASK_PROCDEF`;
ALTER TABLE `flowable`.`act_ru_task` DROP FOREIGN KEY `ACT_FK_TASK_PROCINST`;
ALTER TABLE `flowable`.`act_ru_deadletter_job` DROP FOREIGN KEY `ACT_FK_DEADLETTER_JOB_CUSTOM_VALUES`;
ALTER TABLE `flowable`.`act_ru_deadletter_job` DROP FOREIGN KEY `ACT_FK_DEADLETTER_JOB_EXCEPTION`;
ALTER TABLE `flowable`.`act_ru_deadletter_job` DROP FOREIGN KEY `ACT_FK_DEADLETTER_JOB_EXECUTION`;
ALTER TABLE `flowable`.`act_ru_deadletter_job` DROP FOREIGN KEY `ACT_FK_DEADLETTER_JOB_PROC_DEF`;
ALTER TABLE `flowable`.`act_ru_deadletter_job` DROP FOREIGN KEY `ACT_FK_DEADLETTER_JOB_PROCESS_INSTANCE`;
ALTER TABLE `flowable`.`act_ru_execution` DROP FOREIGN KEY `ACT_FK_EXE_PARENT`;
ALTER TABLE `flowable`.`act_ru_execution` DROP FOREIGN KEY `ACT_FK_EXE_PROCDEF`;
ALTER TABLE `flowable`.`act_ru_execution` DROP FOREIGN KEY `ACT_FK_EXE_PROCINST`;
ALTER TABLE `flowable`.`act_ru_execution` DROP FOREIGN KEY `ACT_FK_EXE_SUPER`;
ALTER TABLE `flowable`.`act_ru_identitylink` DROP FOREIGN KEY `ACT_FK_ATHRZ_PROCEDEF`;
ALTER TABLE `flowable`.`act_ru_identitylink` DROP FOREIGN KEY `ACT_FK_IDL_PROCINST`;
ALTER TABLE `flowable`.`act_ru_identitylink` DROP FOREIGN KEY `ACT_FK_TSKASS_TASK`;
ALTER TABLE `flowable`.`act_ru_job` DROP FOREIGN KEY `ACT_FK_JOB_CUSTOM_VALUES`;
ALTER TABLE `flowable`.`act_ru_job` DROP FOREIGN KEY `ACT_FK_JOB_EXCEPTION`;
ALTER TABLE `flowable`.`act_ru_job` DROP FOREIGN KEY `ACT_FK_JOB_EXECUTION`;
ALTER TABLE `flowable`.`act_ru_job` DROP FOREIGN KEY `ACT_FK_JOB_PROC_DEF`;
ALTER TABLE `flowable`.`act_ru_job` DROP FOREIGN KEY `ACT_FK_JOB_PROCESS_INSTANCE`;
ALTER TABLE `flowable`.`act_ru_suspended_job` DROP FOREIGN KEY `ACT_FK_SUSPENDED_JOB_CUSTOM_VALUES`;
ALTER TABLE `flowable`.`act_ru_suspended_job` DROP FOREIGN KEY `ACT_FK_SUSPENDED_JOB_EXCEPTION`;
ALTER TABLE `flowable`.`act_ru_suspended_job` DROP FOREIGN KEY `ACT_FK_SUSPENDED_JOB_EXECUTION`;
ALTER TABLE `flowable`.`act_ru_suspended_job` DROP FOREIGN KEY `ACT_FK_SUSPENDED_JOB_PROC_DEF`;
ALTER TABLE `flowable`.`act_ru_suspended_job` DROP FOREIGN KEY `ACT_FK_SUSPENDED_JOB_PROCESS_INSTANCE`;
-- 删除外键约束act_ru_timer_job
ALTER TABLE `flowable`.`act_ru_timer_job` DROP FOREIGN KEY `ACT_FK_TIMER_JOB_CUSTOM_VALUES`;
ALTER TABLE `flowable`.`act_ru_timer_job` DROP FOREIGN