From d78512f6b7a64f200bb7ab16171f130f82ce4679 Mon Sep 17 00:00:00 2001 From: fengqiongfeng Date: Wed, 22 Feb 2023 18:56:16 +0800 Subject: [PATCH] =?UTF-8?q?=20HA-=E6=B7=BB=E5=8A=A0=E9=AB=98=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E7=9B=B8=E5=85=B3=E8=A1=A8=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- distribution/conf/create_mysql_table.sql | 61 +++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/distribution/conf/create_mysql_table.sql b/distribution/conf/create_mysql_table.sql index f859d752..b1e0906c 100644 --- a/distribution/conf/create_mysql_table.sql +++ b/distribution/conf/create_mysql_table.sql @@ -591,4 +591,63 @@ CREATE TABLE `work_order` ( `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `gmt_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='工单表'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='工单表'; + +create table ha_active_standby_relation +( + id bigint unsigned auto_increment comment 'id' + primary key, + active_cluster_phy_id bigint default -1 not null comment '主集群ID', + active_res_name varchar(192) collate utf8_bin default '' not null comment '主资源名称', + standby_cluster_phy_id bigint default -1 not null comment '备集群ID', + standby_res_name varchar(192) collate utf8_bin default '' not null comment '备资源名称', + res_type int default -1 not null comment '资源类型', + status int default -1 not null comment '关系状态', + unique_field varchar(1024) default '' not null comment '唯一字段', + create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', + modify_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间', + kafka_status int default 0 null comment '高可用配置是否完全建立 1:Kafka上该主备关系正常,0:Kafka上该主备关系异常', + constraint uniq_unique_field + unique (unique_field) +) + comment 'HA主备关系表' charset = utf8; + +create index idx_type_active + on ha_active_standby_relation (res_type, active_cluster_phy_id); + +create index idx_type_standby + on ha_active_standby_relation (res_type, standby_cluster_phy_id); + +create table ha_active_standby_switch_job +( + id bigint unsigned auto_increment comment 'id' + primary key, + active_cluster_phy_id bigint default -1 not null comment '主集群ID', + standby_cluster_phy_id bigint default -1 not null comment '备集群ID', + job_status int default -1 not null comment '任务状态', + operator varchar(256) default '' not null comment '操作人', + create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', + modify_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间', + type int default 5 not null comment '1:topic 2:实例 3:逻辑集群 4:物理集群', + active_business_id varchar(100) default '-1' not null comment '主业务id(topicName,实例id,逻辑集群id,物理集群id)', + standby_business_id varchar(100) default '-1' not null comment '备业务id(topicName,实例id,逻辑集群id,物理集群id)' +) + comment 'HA主备关系切换-子任务表' charset = utf8; + + +create table ha_active_standby_switch_sub_job +( + id bigint unsigned auto_increment comment 'id' + primary key, + job_id bigint default -1 not null comment '任务ID', + active_cluster_phy_id bigint default -1 not null comment '主集群ID', + active_res_name varchar(192) collate utf8_bin default '' not null comment '主资源名称', + standby_cluster_phy_id bigint default -1 not null comment '备集群ID', + standby_res_name varchar(192) collate utf8_bin default '' not null comment '备资源名称', + res_type int default -1 not null comment '资源类型', + job_status int default -1 not null comment '任务状态', + extend_data text null comment '扩展数据', + create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', + modify_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间' +) + comment 'HA主备关系-切换任务表' charset = utf8;