1

我正在尝试使用 HA mysql (v8.0) 配置将 IS 设置为密钥管理器 (v3.0.0) 和 api 管理器 (v3.0.0)。在运行用于创建数据库的 sql 脚本时,我从 mysql 中收到关于带有 ON DELETE CASCADE 的外键条目的错误,当组复制打开时,mysql 不支持该条目。如果我只能复制 IS 和 API 管理器但不能复制 mysql,如何创建完全 HA 设置?有解决方法吗?

4

1 回答 1

0

您可以用触发器替换级联操作。这是一个 Oracle 示例。你可以对 MySQL 做同样的事情。

CREATE or REPLACE TRIGGER TRG_DEL_AM_APPLICATION
  BEFORE DELETE
    on AM_APPLICATION
    FOR EACH ROW 
      BEGIN
        DELETE FROM AM_SUBSCRIPTION AMSU WHERE AMSU.APPLICATION_ID = :OLD.APPLICATION_ID;
        DELETE FROM AM_APPLICATION_KEY_MAPPING AMKM WHERE AMKM.APPLICATION_ID = :OLD.APPLICATION_ID;
        DELETE FROM AM_APPLICATION_REGISTRATION AMAR WHERE AMAR.APP_ID = :OLD.APPLICATION_ID;
        DELETE FROM AM_APPLICATION_GROUP_MAPPING AMGM WHERE AMGM.APPLICATION_ID = :OLD.APPLICATION_ID;
    DELETE FROM AM_APPLICATION_ATTRIBUTES AAA WHERE AAA.APPLICATION_ID = :OLD.APPLICATION_ID;
      END;

参考:

[1] https://github.com/bhathiya/apim-multi-dc-sql-scripts/blob/master/dbscripts/multi-dc/oracle/apimgt/tables.sql#L1855

[2] https://docs.oracle.com/goldengate/1212/gg-winux/GWUAD/wu_bidirectional.htm#GWUAD287

于 2020-03-03T08:34:19.053 回答