diff --git a/common/pom.xml b/common/pom.xml
index 7fbd174d6..ab6d80fd4 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -37,7 +37,11 @@
org.slf4j
slf4j-api
-
+
+ dm.jdbc
+ DmJdbcDriver
+ ${dm-jdbc.version}
+
commons-io
commons-io
diff --git a/config/pom.xml b/config/pom.xml
index c10e7df37..db8322ab7 100644
--- a/config/pom.xml
+++ b/config/pom.xml
@@ -32,6 +32,11 @@
https://nacos.io
+
+ dm.jdbc
+ DmJdbcDriver
+ ${dm-jdbc.version}
+
org.springframework.boot
spring-boot-starter-web
diff --git a/distribution/conf/application.properties b/distribution/conf/application.properties
index 61ab2ef32..a64a61a90 100644
--- a/distribution/conf/application.properties
+++ b/distribution/conf/application.properties
@@ -40,10 +40,14 @@ server.port=8848
# db.num=1
### Connect URL of DB:
-# db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
+#db.jdbc-driver-name.0=dm.jdbc.driver.DmDriver
+# db.url.0=db.url.0=jdbc:dm://IP:5236/DB
# db.user.0=nacos
# db.password.0=nacos
+#db.jdbc-driver-name.0?db.pool.config.driverClassName??
+#db.pool.config.driverClassName=dm.jdbc.driver.DmDriver
+
### Connection pool configuration: hikariCP
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
@@ -127,7 +131,7 @@ server.tomcat.accesslog.rotate=true
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd-HH
### The access log pattern:
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
-
+server.tomcat.accesslog.max-days=30
### The directory of access log:
server.tomcat.basedir=file:.
@@ -142,7 +146,7 @@ nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/
nacos.core.auth.system.type=nacos
### If turn on auth system:
-nacos.core.auth.enabled=false
+nacos.core.auth.enabled=true
### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
nacos.core.auth.caching.enabled=true
@@ -152,15 +156,15 @@ nacos.core.auth.enable.userAgentAuthWhite=false
### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
### The two properties is the white list for auth and used by identity the request from other server.
-nacos.core.auth.server.identity.key=
-nacos.core.auth.server.identity.value=
+nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:NACOS_KEY}
+nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_KEY:NACOS_VALUE}
### worked when nacos.core.auth.system.type=nacos
### The token expiration in seconds:
nacos.core.auth.plugin.nacos.token.cache.enable=false
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
### The default token (Base64 String):
-nacos.core.auth.plugin.nacos.token.secret.key=
+nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:TmFjb3NEbXp5ajk5ODEhQCMhUUFaWFNXMWRxaXVkdDhxaWN0ODczMmRhZGhhaXVkZzg2M2tqdg==}
### worked when nacos.core.auth.system.type=ldap,{0} is Placeholder,replace login username
#nacos.core.auth.ldap.url=ldap://localhost:389
diff --git a/distribution/conf/dm-schema.sql b/distribution/conf/dm-schema.sql
new file mode 100644
index 000000000..9016e7db1
--- /dev/null
+++ b/distribution/conf/dm-schema.sql
@@ -0,0 +1,553 @@
+CREATE TABLE "USERS"
+(
+ "USERNAME" VARCHAR(50) NOT NULL,
+ "PASSWORD" VARCHAR(500) NOT NULL,
+ "ENABLED" TINYINT NOT NULL
+);
+
+CREATE TABLE "TENANT_INFO"
+(
+ "ID" BIGINT IDENTITY(1,1) NOT NULL,
+ "KP" VARCHAR(128) NOT NULL,
+ "TENANT_ID" VARCHAR(128) DEFAULT ''
+ NULL,
+ "TENANT_NAME" VARCHAR(128) DEFAULT ''
+ NULL,
+ "TENANT_DESC" VARCHAR(256) NULL,
+ "CREATE_SOURCE" VARCHAR(32) NULL,
+ "GMT_CREATE" BIGINT NOT NULL,
+ "GMT_MODIFIED" BIGINT NOT NULL
+);
+
+CREATE TABLE "TENANT_CAPACITY"
+(
+ "ID" BIGINT IDENTITY(1,1) NOT NULL,
+ "TENANT_ID" VARCHAR(128) DEFAULT ''
+ NOT NULL,
+ "QUOTA" BIGINT DEFAULT 0
+ NOT NULL,
+ "USAGE" BIGINT DEFAULT 0
+ NOT NULL,
+ "MAX_SIZE" BIGINT DEFAULT 0
+ NOT NULL,
+ "MAX_AGGR_COUNT" BIGINT DEFAULT 0
+ NOT NULL,
+ "MAX_AGGR_SIZE" BIGINT DEFAULT 0
+ NOT NULL,
+ "MAX_HISTORY_COUNT" BIGINT DEFAULT 0
+ NOT NULL,
+ "GMT_CREATE" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "GMT_MODIFIED" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL
+);
+
+CREATE TABLE "ROLES"
+(
+ "USERNAME" VARCHAR(50) NOT NULL,
+ "ROLE" VARCHAR(50) NOT NULL
+);
+
+CREATE TABLE "PERMISSIONS"
+(
+ "ROLE" VARCHAR(50) NOT NULL,
+ "RESOURCE" VARCHAR(255) NOT NULL,
+ "ACTION" VARCHAR(8) NOT NULL
+);
+
+CREATE TABLE "HIS_CONFIG_INFO"
+(
+ "ID" DECIMAL(20,0) NOT NULL,
+ "NID" BIGINT IDENTITY(1,1) NOT NULL,
+ "DATA_ID" VARCHAR(255) NOT NULL,
+ "GROUP_ID" VARCHAR(128) NOT NULL,
+ "APP_NAME" VARCHAR(128) NULL,
+ "CONTENT" CLOB NOT NULL,
+ "MD5" VARCHAR(32) NULL,
+ "GMT_CREATE" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "GMT_MODIFIED" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "SRC_USER" TEXT NULL,
+ "SRC_IP" VARCHAR(50) NULL,
+ "OP_TYPE" CHAR(10) NULL,
+ "TENANT_ID" VARCHAR(128) DEFAULT ''
+ NULL,
+ "ENCRYPTED_DATA_KEY" TEXT NOT NULL
+);
+
+CREATE TABLE "GROUP_CAPACITY"
+(
+ "ID" BIGINT IDENTITY(1,1) NOT NULL,
+ "GROUP_ID" VARCHAR(128) DEFAULT ''
+ NOT NULL,
+ "QUOTA" BIGINT DEFAULT 0
+ NOT NULL,
+ "USAGE" BIGINT DEFAULT 0
+ NOT NULL,
+ "MAX_SIZE" BIGINT DEFAULT 0
+ NOT NULL,
+ "MAX_AGGR_COUNT" BIGINT DEFAULT 0
+ NOT NULL,
+ "MAX_AGGR_SIZE" BIGINT DEFAULT 0
+ NOT NULL,
+ "MAX_HISTORY_COUNT" BIGINT DEFAULT 0
+ NOT NULL,
+ "GMT_CREATE" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "GMT_MODIFIED" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL
+);
+
+CREATE TABLE "CONFIG_TAGS_RELATION"
+(
+ "ID" BIGINT NOT NULL,
+ "TAG_NAME" VARCHAR(128) NOT NULL,
+ "TAG_TYPE" VARCHAR(64) NULL,
+ "DATA_ID" VARCHAR(255) NOT NULL,
+ "GROUP_ID" VARCHAR(128) NOT NULL,
+ "TENANT_ID" VARCHAR(128) DEFAULT ''
+ NULL,
+ "NID" BIGINT IDENTITY(1,1) NOT NULL
+);
+
+CREATE TABLE "CONFIG_INFO_TAG"
+(
+ "ID" BIGINT IDENTITY(1,1) NOT NULL,
+ "DATA_ID" VARCHAR(255) NOT NULL,
+ "GROUP_ID" VARCHAR(128) NOT NULL,
+ "TENANT_ID" VARCHAR(128) DEFAULT ''
+ NULL,
+ "TAG_ID" VARCHAR(128) NOT NULL,
+ "APP_NAME" VARCHAR(128) NULL,
+ "CONTENT" CLOB NOT NULL,
+ "MD5" VARCHAR(32) NULL,
+ "GMT_CREATE" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "GMT_MODIFIED" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "SRC_USER" TEXT NULL,
+ "SRC_IP" VARCHAR(50) NULL
+);
+
+CREATE TABLE "CONFIG_INFO_BETA"
+(
+ "ID" BIGINT IDENTITY(1,1) NOT NULL,
+ "DATA_ID" VARCHAR(255) NOT NULL,
+ "GROUP_ID" VARCHAR(128) NOT NULL,
+ "APP_NAME" VARCHAR(128) NULL,
+ "CONTENT" CLOB NOT NULL,
+ "BETA_IPS" VARCHAR(1024) NULL,
+ "MD5" VARCHAR(32) NULL,
+ "GMT_CREATE" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "GMT_MODIFIED" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "SRC_USER" TEXT NULL,
+ "SRC_IP" VARCHAR(50) NULL,
+ "TENANT_ID" VARCHAR(128) DEFAULT ''
+ NULL,
+ "ENCRYPTED_DATA_KEY" TEXT NOT NULL
+);
+
+CREATE TABLE "CONFIG_INFO_AGGR"
+(
+ "ID" BIGINT IDENTITY(1,1) NOT NULL,
+ "DATA_ID" VARCHAR(255) NOT NULL,
+ "GROUP_ID" VARCHAR(128) NOT NULL,
+ "DATUM_ID" VARCHAR(255) NOT NULL,
+ "CONTENT" CLOB NOT NULL,
+ "GMT_MODIFIED" TIMESTAMP(0) NOT NULL,
+ "APP_NAME" VARCHAR(128) NULL,
+ "TENANT_ID" VARCHAR(128) DEFAULT ''
+ NULL
+);
+
+CREATE TABLE "CONFIG_INFO"
+(
+ "ID" BIGINT IDENTITY(1,1) NOT NULL,
+ "DATA_ID" VARCHAR(255) NOT NULL,
+ "GROUP_ID" VARCHAR(128) NULL,
+ "CONTENT" CLOB NOT NULL,
+ "MD5" VARCHAR(32) NULL,
+ "GMT_CREATE" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "GMT_MODIFIED" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP()
+ NOT NULL,
+ "SRC_USER" TEXT NULL,
+ "SRC_IP" VARCHAR(50) NULL,
+ "APP_NAME" VARCHAR(128) NULL,
+ "TENANT_ID" VARCHAR(128) DEFAULT ''
+ NULL,
+ "C_DESC" VARCHAR(256) NULL,
+ "C_USE" VARCHAR(64) NULL,
+ "EFFECT" VARCHAR(64) NULL,
+ "TYPE" VARCHAR(64) NULL,
+ "C_SCHEMA" TEXT NULL,
+ "ENCRYPTED_DATA_KEY" TEXT NOT NULL
+);
+
+SET IDENTITY_INSERT "CONFIG_INFO" ON;
+SET IDENTITY_INSERT "CONFIG_INFO" OFF;
+SET IDENTITY_INSERT "CONFIG_INFO_AGGR" ON;
+SET IDENTITY_INSERT "CONFIG_INFO_AGGR" OFF;
+SET IDENTITY_INSERT "CONFIG_INFO_BETA" ON;
+SET IDENTITY_INSERT "CONFIG_INFO_BETA" OFF;
+SET IDENTITY_INSERT "CONFIG_INFO_TAG" ON;
+SET IDENTITY_INSERT "CONFIG_INFO_TAG" OFF;
+SET IDENTITY_INSERT "CONFIG_TAGS_RELATION" ON;
+SET IDENTITY_INSERT "CONFIG_TAGS_RELATION" OFF;
+SET IDENTITY_INSERT "GROUP_CAPACITY" ON;
+SET IDENTITY_INSERT "GROUP_CAPACITY" OFF;
+SET IDENTITY_INSERT "HIS_CONFIG_INFO" ON;
+SET IDENTITY_INSERT "HIS_CONFIG_INFO" OFF;
+INSERT INTO "ROLES"("USERNAME","ROLE") VALUES('nacos','ROLE_ADMIN');
+
+SET IDENTITY_INSERT "TENANT_CAPACITY" ON;
+SET IDENTITY_INSERT "TENANT_CAPACITY" OFF;
+SET IDENTITY_INSERT "TENANT_INFO" ON;
+SET IDENTITY_INSERT "TENANT_INFO" OFF;
+INSERT INTO "USERS"("USERNAME","PASSWORD","ENABLED") VALUES('nacos','$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu',1);
+
+ALTER TABLE "USERS" ADD CONSTRAINT PRIMARY KEY("USERNAME") ;
+
+ALTER TABLE "TENANT_INFO" ADD CONSTRAINT PRIMARY KEY("ID") ;
+
+ALTER TABLE "TENANT_INFO" ADD CONSTRAINT "UK_TENANT_INFO_KPTENANTID" UNIQUE("KP","TENANT_ID") ;
+
+ALTER TABLE "TENANT_CAPACITY" ADD CONSTRAINT PRIMARY KEY("ID") ;
+
+ALTER TABLE "TENANT_CAPACITY" ADD CONSTRAINT "UK_TENANT_ID" UNIQUE("TENANT_ID") ;
+
+ALTER TABLE "ROLES" ADD CONSTRAINT "IDX_USER_ROLE" UNIQUE("USERNAME","ROLE") ;
+
+ALTER TABLE "PERMISSIONS" ADD CONSTRAINT "UK_ROLE_PERMISSION" UNIQUE("ROLE","RESOURCE","ACTION") ;
+
+ALTER TABLE "HIS_CONFIG_INFO" ADD CONSTRAINT PRIMARY KEY("NID") ;
+
+ALTER TABLE "GROUP_CAPACITY" ADD CONSTRAINT PRIMARY KEY("ID") ;
+
+ALTER TABLE "GROUP_CAPACITY" ADD CONSTRAINT "UK_GROUP_ID" UNIQUE("GROUP_ID") ;
+
+ALTER TABLE "CONFIG_TAGS_RELATION" ADD CONSTRAINT PRIMARY KEY("NID") ;
+
+ALTER TABLE "CONFIG_TAGS_RELATION" ADD CONSTRAINT "UK_CONFIGTAGRELATION_CONFIGIDTAG" UNIQUE("ID","TAG_NAME","TAG_TYPE") ;
+
+ALTER TABLE "CONFIG_INFO_TAG" ADD CONSTRAINT PRIMARY KEY("ID") ;
+
+ALTER TABLE "CONFIG_INFO_TAG" ADD CONSTRAINT "UK_CONFIGINFOTAG_DATAGROUPTENANTTAG" UNIQUE("DATA_ID","GROUP_ID","TENANT_ID","TAG_ID") ;
+
+ALTER TABLE "CONFIG_INFO_BETA" ADD CONSTRAINT PRIMARY KEY("ID") ;
+
+ALTER TABLE "CONFIG_INFO_BETA" ADD CONSTRAINT "UK_CONFIGINFOBETA_DATAGROUPTENANT" UNIQUE("DATA_ID","GROUP_ID","TENANT_ID") ;
+
+ALTER TABLE "CONFIG_INFO_AGGR" ADD CONSTRAINT PRIMARY KEY("ID") ;
+
+ALTER TABLE "CONFIG_INFO_AGGR" ADD CONSTRAINT "UK_CONFIGINFOAGGR_DATAGROUPTENANTDATUM" UNIQUE("DATA_ID","GROUP_ID","TENANT_ID","DATUM_ID") ;
+
+ALTER TABLE "CONFIG_INFO" ADD CONSTRAINT PRIMARY KEY("ID") ;
+
+ALTER TABLE "CONFIG_INFO" ADD CONSTRAINT "UK_CONFIGINFO_DATAGROUPTENANT" UNIQUE("DATA_ID","GROUP_ID","TENANT_ID") ;
+
+CREATE UNIQUE INDEX "PRIMARY"
+ ON "USERS"("USERNAME");
+
+COMMENT ON COLUMN "USERS"."USERNAME" IS 'username';
+
+COMMENT ON COLUMN "USERS"."PASSWORD" IS 'password';
+
+COMMENT ON COLUMN "USERS"."ENABLED" IS 'enabled';
+
+CREATE INDEX "IDX_TENANT_ID"
+ ON "TENANT_INFO"("TENANT_ID");
+
+CREATE UNIQUE INDEX "INDEX134402165964299"
+ ON "TENANT_INFO"("ID");
+
+COMMENT ON TABLE "TENANT_INFO" IS 'tenant_info';
+
+COMMENT ON COLUMN "TENANT_INFO"."ID" IS 'id';
+
+COMMENT ON COLUMN "TENANT_INFO"."KP" IS 'kp';
+
+COMMENT ON COLUMN "TENANT_INFO"."TENANT_ID" IS 'tenant_id';
+
+COMMENT ON COLUMN "TENANT_INFO"."TENANT_NAME" IS 'tenant_name';
+
+COMMENT ON COLUMN "TENANT_INFO"."TENANT_DESC" IS 'tenant_desc';
+
+COMMENT ON COLUMN "TENANT_INFO"."CREATE_SOURCE" IS 'create_source';
+
+COMMENT ON COLUMN "TENANT_INFO"."GMT_CREATE" IS '创建时间';
+
+COMMENT ON COLUMN "TENANT_INFO"."GMT_MODIFIED" IS '修改时间';
+
+ALTER TABLE "TENANT_CAPACITY" ADD CHECK ("QUOTA" >= 0) ENABLE ;
+
+ALTER TABLE "TENANT_CAPACITY" ADD CHECK ("MAX_HISTORY_COUNT" >= 0) ENABLE ;
+
+ALTER TABLE "TENANT_CAPACITY" ADD CHECK ("MAX_AGGR_SIZE" >= 0) ENABLE ;
+
+ALTER TABLE "TENANT_CAPACITY" ADD CHECK ("MAX_AGGR_COUNT" >= 0) ENABLE ;
+
+ALTER TABLE "TENANT_CAPACITY" ADD CHECK ("MAX_SIZE" >= 0) ENABLE ;
+
+ALTER TABLE "TENANT_CAPACITY" ADD CHECK ("USAGE" >= 0) ENABLE ;
+
+CREATE UNIQUE INDEX "INDEX134403016796300"
+ ON "TENANT_CAPACITY"("ID");
+
+COMMENT ON TABLE "TENANT_CAPACITY" IS '租户容量信息表';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."ID" IS '主键ID';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."TENANT_ID" IS 'Tenant ID';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."QUOTA" IS '配额,0表示使用默认值';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."USAGE" IS '使用量';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."MAX_SIZE" IS '单个配置大小上限,单位为字节,0表示使用默认值';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."MAX_AGGR_COUNT" IS '聚合子配置最大个数';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."MAX_AGGR_SIZE" IS '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."MAX_HISTORY_COUNT" IS '最大变更历史数量';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."GMT_CREATE" IS '创建时间';
+
+COMMENT ON COLUMN "TENANT_CAPACITY"."GMT_MODIFIED" IS '修改时间';
+
+COMMENT ON COLUMN "ROLES"."USERNAME" IS 'username';
+
+COMMENT ON COLUMN "ROLES"."ROLE" IS 'role';
+
+COMMENT ON COLUMN "PERMISSIONS"."ROLE" IS 'role';
+
+COMMENT ON COLUMN "PERMISSIONS"."RESOURCE" IS 'resource';
+
+COMMENT ON COLUMN "PERMISSIONS"."ACTION" IS 'action';
+
+ALTER TABLE "HIS_CONFIG_INFO" ADD CHECK ("ID" >= 0) ENABLE ;
+
+CREATE INDEX "IDX_DID"
+ ON "HIS_CONFIG_INFO"("DATA_ID");
+
+CREATE INDEX "IDX_GMT_MODIFIED"
+ ON "HIS_CONFIG_INFO"("GMT_MODIFIED");
+
+CREATE INDEX "IDX_GMT_CREATE"
+ ON "HIS_CONFIG_INFO"("GMT_CREATE");
+
+CREATE UNIQUE INDEX "INDEX134404266256800"
+ ON "HIS_CONFIG_INFO"("NID");
+
+COMMENT ON TABLE "HIS_CONFIG_INFO" IS '多租户改造';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."ID" IS 'id';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."NID" IS 'nid, 自增标识';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."DATA_ID" IS 'data_id';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."GROUP_ID" IS 'group_id';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."APP_NAME" IS 'app_name';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."CONTENT" IS 'content';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."MD5" IS 'md5';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."GMT_CREATE" IS '创建时间';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."GMT_MODIFIED" IS '修改时间';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."SRC_USER" IS 'source user';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."SRC_IP" IS 'source ip';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."OP_TYPE" IS 'operation type';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."TENANT_ID" IS '租户字段';
+
+COMMENT ON COLUMN "HIS_CONFIG_INFO"."ENCRYPTED_DATA_KEY" IS '密钥';
+
+ALTER TABLE "GROUP_CAPACITY" ADD CHECK ("QUOTA" >= 0) ENABLE ;
+
+ALTER TABLE "GROUP_CAPACITY" ADD CHECK ("MAX_HISTORY_COUNT" >= 0) ENABLE ;
+
+ALTER TABLE "GROUP_CAPACITY" ADD CHECK ("MAX_AGGR_SIZE" >= 0) ENABLE ;
+
+ALTER TABLE "GROUP_CAPACITY" ADD CHECK ("MAX_AGGR_COUNT" >= 0) ENABLE ;
+
+ALTER TABLE "GROUP_CAPACITY" ADD CHECK ("MAX_SIZE" >= 0) ENABLE ;
+
+ALTER TABLE "GROUP_CAPACITY" ADD CHECK ("USAGE" >= 0) ENABLE ;
+
+CREATE UNIQUE INDEX "INDEX134405629453900"
+ ON "GROUP_CAPACITY"("ID");
+
+COMMENT ON TABLE "GROUP_CAPACITY" IS '集群、各Group容量信息表';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."ID" IS '主键ID';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."GROUP_ID" IS 'Group ID,空字符表示整个集群';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."QUOTA" IS '配额,0表示使用默认值';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."USAGE" IS '使用量';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."MAX_SIZE" IS '单个配置大小上限,单位为字节,0表示使用默认值';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."MAX_AGGR_COUNT" IS '聚合子配置最大个数,,0表示使用默认值';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."MAX_AGGR_SIZE" IS '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."MAX_HISTORY_COUNT" IS '最大变更历史数量';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."GMT_CREATE" IS '创建时间';
+
+COMMENT ON COLUMN "GROUP_CAPACITY"."GMT_MODIFIED" IS '修改时间';
+
+CREATE INDEX "INDEX134406418558100"
+ ON "CONFIG_TAGS_RELATION"("TENANT_ID");
+
+CREATE UNIQUE INDEX "INDEX134406537578900"
+ ON "CONFIG_TAGS_RELATION"("NID");
+
+COMMENT ON TABLE "CONFIG_TAGS_RELATION" IS 'config_tag_relation';
+
+COMMENT ON COLUMN "CONFIG_TAGS_RELATION"."ID" IS 'id';
+
+COMMENT ON COLUMN "CONFIG_TAGS_RELATION"."TAG_NAME" IS 'tag_name';
+
+COMMENT ON COLUMN "CONFIG_TAGS_RELATION"."TAG_TYPE" IS 'tag_type';
+
+COMMENT ON COLUMN "CONFIG_TAGS_RELATION"."DATA_ID" IS 'data_id';
+
+COMMENT ON COLUMN "CONFIG_TAGS_RELATION"."GROUP_ID" IS 'group_id';
+
+COMMENT ON COLUMN "CONFIG_TAGS_RELATION"."TENANT_ID" IS 'tenant_id';
+
+COMMENT ON COLUMN "CONFIG_TAGS_RELATION"."NID" IS 'nid, 自增长标识';
+
+CREATE UNIQUE INDEX "INDEX134407033963000"
+ ON "CONFIG_INFO_TAG"("ID");
+
+COMMENT ON TABLE "CONFIG_INFO_TAG" IS 'config_info_tag';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."ID" IS 'id';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."DATA_ID" IS 'data_id';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."GROUP_ID" IS 'group_id';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."TENANT_ID" IS 'tenant_id';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."TAG_ID" IS 'tag_id';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."APP_NAME" IS 'app_name';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."CONTENT" IS 'content';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."MD5" IS 'md5';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."GMT_CREATE" IS '创建时间';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."GMT_MODIFIED" IS '修改时间';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."SRC_USER" IS 'source user';
+
+COMMENT ON COLUMN "CONFIG_INFO_TAG"."SRC_IP" IS 'source ip';
+
+CREATE UNIQUE INDEX "INDEX134407798104699"
+ ON "CONFIG_INFO_BETA"("ID");
+
+COMMENT ON TABLE "CONFIG_INFO_BETA" IS 'config_info_beta';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."ID" IS 'id';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."DATA_ID" IS 'data_id';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."GROUP_ID" IS 'group_id';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."APP_NAME" IS 'app_name';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."CONTENT" IS 'content';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."BETA_IPS" IS 'betaIps';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."MD5" IS 'md5';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."GMT_CREATE" IS '创建时间';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."GMT_MODIFIED" IS '修改时间';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."SRC_USER" IS 'source user';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."SRC_IP" IS 'source ip';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."TENANT_ID" IS '租户字段';
+
+COMMENT ON COLUMN "CONFIG_INFO_BETA"."ENCRYPTED_DATA_KEY" IS '密钥';
+
+CREATE UNIQUE INDEX "INDEX134408619300900"
+ ON "CONFIG_INFO_AGGR"("ID");
+
+COMMENT ON TABLE "CONFIG_INFO_AGGR" IS '增加租户字段';
+
+COMMENT ON COLUMN "CONFIG_INFO_AGGR"."ID" IS 'id';
+
+COMMENT ON COLUMN "CONFIG_INFO_AGGR"."DATA_ID" IS 'data_id';
+
+COMMENT ON COLUMN "CONFIG_INFO_AGGR"."GROUP_ID" IS 'group_id';
+
+COMMENT ON COLUMN "CONFIG_INFO_AGGR"."DATUM_ID" IS 'datum_id';
+
+COMMENT ON COLUMN "CONFIG_INFO_AGGR"."CONTENT" IS '内容';
+
+COMMENT ON COLUMN "CONFIG_INFO_AGGR"."GMT_MODIFIED" IS '修改时间';
+
+COMMENT ON COLUMN "CONFIG_INFO_AGGR"."APP_NAME" IS 'app_name';
+
+COMMENT ON COLUMN "CONFIG_INFO_AGGR"."TENANT_ID" IS '租户字段';
+
+CREATE UNIQUE INDEX "INDEX134409166029299"
+ ON "CONFIG_INFO"("ID");
+
+COMMENT ON TABLE "CONFIG_INFO" IS 'config_info';
+
+COMMENT ON COLUMN "CONFIG_INFO"."ID" IS 'id';
+
+COMMENT ON COLUMN "CONFIG_INFO"."DATA_ID" IS 'data_id';
+
+COMMENT ON COLUMN "CONFIG_INFO"."GROUP_ID" IS 'group_id';
+
+COMMENT ON COLUMN "CONFIG_INFO"."CONTENT" IS 'content';
+
+COMMENT ON COLUMN "CONFIG_INFO"."MD5" IS 'md5';
+
+COMMENT ON COLUMN "CONFIG_INFO"."GMT_CREATE" IS '创建时间';
+
+COMMENT ON COLUMN "CONFIG_INFO"."GMT_MODIFIED" IS '修改时间';
+
+COMMENT ON COLUMN "CONFIG_INFO"."SRC_USER" IS 'source user';
+
+COMMENT ON COLUMN "CONFIG_INFO"."SRC_IP" IS 'source ip';
+
+COMMENT ON COLUMN "CONFIG_INFO"."APP_NAME" IS 'app_name';
+
+COMMENT ON COLUMN "CONFIG_INFO"."TENANT_ID" IS '租户字段';
+
+COMMENT ON COLUMN "CONFIG_INFO"."C_DESC" IS 'configuration description';
+
+COMMENT ON COLUMN "CONFIG_INFO"."C_USE" IS 'configuration usage';
+
+COMMENT ON COLUMN "CONFIG_INFO"."EFFECT" IS '配置生效的描述';
+
+COMMENT ON COLUMN "CONFIG_INFO"."TYPE" IS '配置的类型';
+
+COMMENT ON COLUMN "CONFIG_INFO"."C_SCHEMA" IS '配置的模式';
+
+COMMENT ON COLUMN "CONFIG_INFO"."ENCRYPTED_DATA_KEY" IS '密钥';
\ No newline at end of file
diff --git a/naming/pom.xml b/naming/pom.xml
index ea7e1191b..a8edc45d8 100644
--- a/naming/pom.xml
+++ b/naming/pom.xml
@@ -34,6 +34,11 @@
https://nacos.io
+
+ dm.jdbc
+ DmJdbcDriver
+ ${dm-jdbc.version}
+
${project.groupId}
nacos-core
diff --git a/persistence/src/main/java/com/alibaba/nacos/persistence/constants/PersistenceConstant.java b/persistence/src/main/java/com/alibaba/nacos/persistence/constants/PersistenceConstant.java
index b663e1190..11491dd26 100644
--- a/persistence/src/main/java/com/alibaba/nacos/persistence/constants/PersistenceConstant.java
+++ b/persistence/src/main/java/com/alibaba/nacos/persistence/constants/PersistenceConstant.java
@@ -31,7 +31,7 @@ public class PersistenceConstant {
public static final String DATASOURCE_PLATFORM_PROPERTY_OLD = "spring.datasource.platform";
public static final String DATASOURCE_PLATFORM_PROPERTY = "spring.sql.init.platform";
-
+ public static final String DM = "dm";
public static final String MYSQL = "mysql";
public static final String DERBY = "derby";
diff --git a/persistence/src/main/java/com/alibaba/nacos/persistence/datasource/ExternalDataSourceProperties.java b/persistence/src/main/java/com/alibaba/nacos/persistence/datasource/ExternalDataSourceProperties.java
index cf5663441..9282cd252 100644
--- a/persistence/src/main/java/com/alibaba/nacos/persistence/datasource/ExternalDataSourceProperties.java
+++ b/persistence/src/main/java/com/alibaba/nacos/persistence/datasource/ExternalDataSourceProperties.java
@@ -48,7 +48,15 @@ public class ExternalDataSourceProperties {
private List user = new ArrayList<>();
private List password = new ArrayList<>();
-
+ private List jdbcDriverName = new ArrayList<>();
+
+ public List getJdbcDriverName() {
+ return jdbcDriverName;
+ }
+
+ public void setJdbcDriverName(List jdbcDriverName) {
+ this.jdbcDriverName = jdbcDriverName;
+ }
public void setNum(Integer num) {
this.num = num;
}
@@ -83,7 +91,7 @@ public class ExternalDataSourceProperties {
Preconditions.checkArgument(url.size() >= currentSize, "db.url.%s is null", index);
DataSourcePoolProperties poolProperties = DataSourcePoolProperties.build(environment);
if (StringUtils.isEmpty(poolProperties.getDataSource().getDriverClassName())) {
- poolProperties.setDriverClassName(JDBC_DRIVER_NAME);
+ poolProperties.setDriverClassName(getOrDefault(jdbcDriverName,index,jdbcDriverName.get(index)).trim());
}
poolProperties.setJdbcUrl(url.get(index).trim());
poolProperties.setUsername(getOrDefault(user, index, user.get(0)).trim());
diff --git a/plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/persistence/handler/PageHandlerAdapterFactory.java b/plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/persistence/handler/PageHandlerAdapterFactory.java
index 50f8e428b..2d9ba9d74 100644
--- a/plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/persistence/handler/PageHandlerAdapterFactory.java
+++ b/plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/persistence/handler/PageHandlerAdapterFactory.java
@@ -18,6 +18,7 @@ package com.alibaba.nacos.plugin.auth.impl.persistence.handler;
import com.alibaba.nacos.plugin.auth.impl.persistence.handler.support.DefaultPageHandlerAdapter;
import com.alibaba.nacos.plugin.auth.impl.persistence.handler.support.DerbyPageHandlerAdapter;
+import com.alibaba.nacos.plugin.auth.impl.persistence.handler.support.DmPageHandlerAdapter;
import com.alibaba.nacos.plugin.auth.impl.persistence.handler.support.MysqlPageHandlerAdapter;
import java.util.ArrayList;
@@ -53,6 +54,8 @@ public class PageHandlerAdapterFactory {
handlerAdapters.add(handlerAdapter);
handlerAdapterMap.put(handlerAdapter.getClass().getName(), handlerAdapter);
};
+ // DmPageHandlerAdapter
+ addHandlerAdapter.accept(new DmPageHandlerAdapter());
// MysqlPageHandlerAdapter
addHandlerAdapter.accept(new MysqlPageHandlerAdapter());
// DerbyPageHandlerAdapter
diff --git a/plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/persistence/handler/support/DmPageHandlerAdapter.java b/plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/persistence/handler/support/DmPageHandlerAdapter.java
new file mode 100644
index 000000000..84756b8ef
--- /dev/null
+++ b/plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/persistence/handler/support/DmPageHandlerAdapter.java
@@ -0,0 +1,34 @@
+package com.alibaba.nacos.plugin.auth.impl.persistence.handler.support;
+
+import com.alibaba.nacos.persistence.constants.PersistenceConstant;
+import com.alibaba.nacos.plugin.auth.impl.constant.AuthPageConstant;
+import com.alibaba.nacos.plugin.auth.impl.model.OffsetFetchResult;
+import com.alibaba.nacos.plugin.auth.impl.persistence.handler.PageHandlerAdapter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class DmPageHandlerAdapter implements PageHandlerAdapter {
+
+ @Override
+ public boolean supports(String dataSourceType) {
+ return PersistenceConstant.DM.equals(dataSourceType);
+ }
+
+ @Override
+ public OffsetFetchResult addOffsetAndFetchNext(String fetchSql, Object[] arg, int pageNo, int pageSize) {
+ if (!fetchSql.contains(AuthPageConstant.LIMIT)) {
+ fetchSql += " " + AuthPageConstant.LIMIT_SIZE;
+ List