Compare commits

...

20 Commits

Author SHA1 Message Date
zhuyijun
e43767e963 2.3.0新增达梦适配 2024-07-22 16:54:41 +08:00
杨翊 SionYang
8ac6c84a58
Merge pull request #11452 from alibaba/develop
Upgrade to 2.3.0
2023-11-30 11:22:14 +08:00
杨翊 SionYang
ca6d1518bf
Merge pull request #11266 from alibaba/develop
2.3.0-BETA release
2023-10-19 11:39:12 +08:00
杨翊 SionYang
cb0422ed74
Merge pull request #10126 from alibaba/develop
Merge from develop.
2023-03-17 18:20:52 +08:00
杨翊 SionYang
38faeea58d
Merge pull request #9707 from alibaba/develop
Merge develop into master to release 2.2.0
2022-12-14 14:14:14 +08:00
杨翊 SionYang
2eb7f739fd
Merge pull request #9335 from alibaba/develop
Upgrade to 2.1.2
2022-10-17 14:25:26 +08:00
杨翊 SionYang
41859be6a9
Merge pull request #8902 from alibaba/develop
Upgrade 2.1.1
2022-08-08 18:12:15 +08:00
杨翊 SionYang
b584531331
Merge pull request #8279 from alibaba/develop
Upgrade to 2.1.0
2022-04-29 09:53:19 +08:00
杨翊 SionYang
8e9f718d68
Merge pull request #7657 from alibaba/develop
Release 2.0.4
2022-01-18 10:06:18 +08:00
杨翊 SionYang
5a4d433970
Merge pull request #6494 from alibaba/develop
Upgrade to 2.0.3
2021-07-28 19:21:57 +08:00
杨翊 SionYang
1fac5c8334
Merge pull request #6052 from alibaba/develop
Upgrade to 2.0.2
2021-06-11 15:42:54 +08:00
杨翊 SionYang
11be620808
Merge pull request #5532 from alibaba/develop
Merge develop to master, upgrade version to 1.4.2
2021-04-29 16:37:04 +08:00
杨翊 SionYang
a18c27c385
Merge pull request #4704 from alibaba/develop
Fix #4701 (#4703)
2021-01-14 21:05:31 +08:00
杨翊 SionYang
1d88d5d773
Merge pull request #4696 from alibaba/develop
Upgrade to 1.4.1
2021-01-14 11:56:52 +08:00
杨翊 SionYang
023f50cb61
Revert "fix: 修复参数类型注释及单词拼写错误 (#4413)" (#4417)
This reverts commit b9a842c83f.
2020-12-07 09:40:54 +08:00
Brent
b9a842c83f
fix: 修复参数类型注释及单词拼写错误 (#4413) 2020-12-07 09:16:18 +08:00
杨翊 SionYang
c0ffb1d7e3
Merge pull request #4119 from alibaba/develop
Master upgrade 1.4.0
2020-11-02 20:37:27 +08:00
杨翊 SionYang
a341b65151
Merge pull request #3519 from alibaba/develop
Upgrade to 1.3.2
2020-08-04 19:23:08 +08:00
杨翊 SionYang
5e53396f78
Merge pull request #3295 from alibaba/develop
Upgrade to 1.3.1 version
2020-07-10 19:01:39 +08:00
yanlinly
c648249822
Merge pull request #2964 from alibaba/develop
update version to 1.3.0
2020-06-05 16:31:09 +08:00
32 changed files with 1524 additions and 69 deletions

View File

@ -33,6 +33,11 @@
<url>https://nacos.io</url>
<description>Nacos common pom.xml file</description>
<dependencies>
<dependency>
<groupId>dm.jdbc</groupId>
<artifactId>DmJdbcDriver</artifactId>
<version>${dm-jdbc.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>

View File

@ -32,6 +32,11 @@
<url>https://nacos.io</url>
<dependencies>
<dependency>
<groupId>dm.jdbc</groupId>
<artifactId>DmJdbcDriver</artifactId>
<version>${dm-jdbc.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>

View File

@ -20,7 +20,7 @@ server.servlet.contextPath=/nacos
### Include message field
server.error.include-message=ALWAYS
### Default web server port:
server.port=8848
server.port=30050
#*************** Network Related Configurations ***************#
### If prefer hostname over ip for Nacos server addresses in cluster.conf:
@ -33,14 +33,18 @@ server.port=8848
### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
# spring.datasource.platform=mysql
# nacos.plugin.datasource.log.enabled=true
#spring.sql.init.platform=mysql
spring.sql.init.platform=dm
### Count of DB:
# db.num=1
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.user=nacos
# db.password=nacos
db.jdbc-driver-name.0=dm.jdbc.driver.DmDriver
db.url.0=jdbc:dm://220.8.40.1:5236/BCS
db.user.0=BCS
db.password.0=BCS
### the maximum retry times for push
nacos.config.push.maxRetryTime=50
@ -113,7 +117,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
@ -123,8 +127,8 @@ 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:BCS_NACOS}
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_KEY:BCS_NACOS}
### worked when nacos.core.auth.system.type=nacos
### The token expiration in seconds:
@ -132,7 +136,8 @@ 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=SecretKey012345678901234567890123456789012345678901234567890123456789
nacos.core.auth.plugin.nacos.token.secret.key=
nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:SecretKey01234567890123456789012345345678999987654901234567890123456789}
#nacos.core.auth.plugin.nacos.token.secret.key=
### worked when nacos.core.auth.system.type=ldap{0} is Placeholder,replace login username
#nacos.core.auth.ldap.url=ldap://localhost:389

View File

@ -20,7 +20,7 @@ server.servlet.contextPath=/nacos
### Include message field
server.error.include-message=ALWAYS
### Default web server port:
server.port=8848
server.port=30050
#*************** Network Related Configurations ***************#
### If prefer hostname over ip for Nacos server addresses in cluster.conf:
@ -33,16 +33,20 @@ server.port=8848
#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
# spring.datasource.platform=mysql
# spring.sql.init.platform=mysql
#spring.datasource.platform=dm
spring.sql.init.platform=dm
### Count of DB:
# db.num=1
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.user.0=nacos
# db.password.0=nacos
db.jdbc-driver-name.0=dm.jdbc.driver.DmDriver
db.url.0=jdbc:dm://220.8.40.1:5236/BCS
db.user.0=BCS
db.password.0=BCS
### Connection pool configuration: hikariCP
db.pool.config.connectionTimeout=30000
@ -76,7 +80,9 @@ nacos.config.push.maxRetryTime=50
### The delay time before push task to execute from service changed, unit: milliseconds.
# nacos.naming.push.pushTaskDelay=500
nacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000
### The timeout for push task execute, unit: milliseconds.
# nacos.naming.push.pushTaskTimeout=5000
@ -102,7 +108,7 @@ nacos.config.push.maxRetryTime=50
#***********Metrics for tomcat **************************#
server.tomcat.mbeanregistry.enabled=true
server.tomcat.accesslog.max-days=30
#***********Expose prometheus and health **************************#
#management.endpoints.web.exposure.include=prometheus,health
@ -142,7 +148,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 +158,18 @@ 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.core.auth.server.identity.value=
nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:BCS_NACOS}
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_KEY:BCS_NACOS}
### 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.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:SecretKey01234567890123456789012345345678999987654901234567890123456789}
### worked when nacos.core.auth.system.type=ldap{0} is Placeholder,replace login username
#nacos.core.auth.ldap.url=ldap://localhost:389

View File

@ -20,7 +20,7 @@ server.servlet.contextPath=/nacos
### Include message field
server.error.include-message=ALWAYS
### Default web server port:
server.port=8848
server.port=30050
#*************** Network Related Configurations ***************#
### If prefer hostname over ip for Nacos server addresses in cluster.conf:
@ -33,16 +33,20 @@ server.port=8848
#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
# spring.datasource.platform=mysql
# spring.sql.init.platform=mysql
#spring.datasource.platform=dm
spring.sql.init.platform=dm
### Count of DB:
# db.num=1
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.user.0=nacos
# db.password.0=nacos
db.jdbc-driver-name.0=dm.jdbc.driver.DmDriver
db.url.0=jdbc:dm://220.8.40.1:5236/BCS
db.user.0=BCS
db.password.0=BCS
### Connection pool configuration: hikariCP
db.pool.config.connectionTimeout=30000
@ -54,17 +58,13 @@ db.pool.config.minimumIdle=2
nacos.config.push.maxRetryTime=50
#*************** Naming Module Related Configurations ***************#
### If enable data warmup. If set to false, the server would accept request without local data preparation:
# nacos.naming.data.warmup=true
### If enable the instance auto expiration, kind like of health check of instance:
# nacos.naming.expireInstance=true
### will be removed and replaced by `nacos.naming.clean` properties
nacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000
### Add in 2.0.0
### The interval to clean empty service, unit: milliseconds.
# nacos.naming.clean.empty-service.interval=60000
@ -80,7 +80,9 @@ nacos.naming.empty-service.clean.period-time-ms=30000
### The delay time before push task to execute from service changed, unit: milliseconds.
# nacos.naming.push.pushTaskDelay=500
nacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000
### The timeout for push task execute, unit: milliseconds.
# nacos.naming.push.pushTaskTimeout=5000
@ -104,10 +106,11 @@ nacos.naming.empty-service.clean.period-time-ms=30000
### If turn on data loading task:
# nacos.cmdb.loadDataAtStart=false
#*************** Metrics Related Configurations ***************#
### Metrics for prometheus
#management.endpoints.web.exposure.include=*
#***********Metrics for tomcat **************************#
server.tomcat.mbeanregistry.enabled=true
server.tomcat.accesslog.max-days=30
#***********Expose prometheus and health **************************#
#management.endpoints.web.exposure.include=prometheus,health
### Metrics for elastic search
management.metrics.export.elastic.enabled=false
@ -125,6 +128,9 @@ management.metrics.export.influx.enabled=false
### If turn on the access log:
server.tomcat.accesslog.enabled=true
### file name pattern, one file per hour
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
@ -135,33 +141,14 @@ server.tomcat.basedir=file:.
### If enable spring security, this option is deprecated in 1.2.0:
#spring.security.enabled=false
### The ignore urls of auth, is deprecated in 1.2.0:
### The ignore urls of auth
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
### The auth system to use, currently only 'nacos' and 'ldap' is supported:
nacos.core.auth.system.type=nacos
### If turn on auth system:
nacos.core.auth.enabled=false
### worked when nacos.core.auth.system.type=ldap{0} is Placeholder,replace login username
#nacos.core.auth.system.type=ldap
#nacos.core.auth.ldap.url=ldap://localhost:389
#nacos.core.auth.ldap.basedc=dc=example,dc=org
#nacos.core.auth.ldap.userDn=cn=admin,${nacos.core.auth.ldap.basedc}
#nacos.core.auth.ldap.password=admin
#nacos.core.auth.ldap.userdn=cn={0},dc=example,dc=org
#nacos.core.auth.ldap.filter.prefix=uid
#nacos.core.auth.ldap.case.sensitive=true
#nacos.core.auth.ldap.ignore.partial.result.exception=false
### 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.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
@ -171,8 +158,53 @@ 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=example
#nacos.core.auth.server.identity.value=example
#nacos.core.auth.server.identity.key=
#nacos.core.auth.server.identity.value=
nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:BCS_NACOS}
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_KEY:BCS_NACOS}
### 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:SecretKey01234567890123456789012345345678999987654901234567890123456789}
### worked when nacos.core.auth.system.type=ldap,{0} is Placeholder,replace login username
#nacos.core.auth.ldap.url=ldap://localhost:389
#nacos.core.auth.ldap.basedc=dc=example,dc=org
#nacos.core.auth.ldap.userDn=cn=admin,${nacos.core.auth.ldap.basedc}
#nacos.core.auth.ldap.password=admin
#nacos.core.auth.ldap.userdn=cn={0},dc=example,dc=org
#nacos.core.auth.ldap.filter.prefix=uid
#nacos.core.auth.ldap.case.sensitive=true
#nacos.core.auth.ldap.ignore.partial.result.exception=false
#*************** Control Plugin Related Configurations ***************#
# plugin type
#nacos.plugin.control.manager.type=nacos
# local control rule storage dir, default ${nacos.home}/data/connection and ${nacos.home}/data/tps
#nacos.plugin.control.rule.local.basedir=${nacos.home}
# external control rule storage type, if exist
#nacos.plugin.control.rule.external.storage=
#*************** Config Change Plugin Related Configurations ***************#
# webhook
#nacos.core.config.plugin.webhook.enabled=false
# It is recommended to use EB https://help.aliyun.com/document_detail/413974.html
#nacos.core.config.plugin.webhook.url=http://localhost:8080/webhook/send?token=***
# The content push max capacity ,byte
#nacos.core.config.plugin.webhook.contentMaxCapacity=102400
# whitelist
#nacos.core.config.plugin.whitelist.enabled=false
# The import file suffixs
#nacos.core.config.plugin.whitelist.suffixs=xml,text,properties,yaml,html
# fileformatcheck,which validate the import file of type and content
#nacos.core.config.plugin.fileformatcheck.enabled=false
#*************** Istio Related Configurations ***************#
### If turn on the MCP server:
@ -269,3 +301,6 @@ nacos.istio.mcp.server.enabled=false
## Sets a time(milliseconds) that specify the most aggressive keep-alive time clients are permitted to configure. The typical default is 5 minutes
#nacos.remote.server.grpc.cluster.permit-keep-alive-time=300000
## open nacos default console ui
#nacos.console.ui.enabled=true

View File

@ -0,0 +1,554 @@
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 '密钥';

View File

@ -34,6 +34,11 @@
<url>https://nacos.io</url>
<dependencies>
<dependency>
<groupId>dm.jdbc</groupId>
<artifactId>DmJdbcDriver</artifactId>
<version>${dm-jdbc.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>nacos-core</artifactId>

View File

@ -35,6 +35,7 @@ public class PersistenceConstant {
public static final String MYSQL = "mysql";
public static final String DERBY = "derby";
public static final String DM = "dm";
public static final String EMPTY_DATASOURCE_PLATFORM = "";

View File

@ -48,6 +48,7 @@ public class ExternalDataSourceProperties {
private List<String> user = new ArrayList<>();
private List<String> password = new ArrayList<>();
private List<String> jdbcDriverName = new ArrayList<>();
public void setNum(Integer num) {
this.num = num;
@ -83,7 +84,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());
@ -100,6 +101,14 @@ public class ExternalDataSourceProperties {
return dataSources;
}
public List<String> getJdbcDriverName() {
return jdbcDriverName;
}
public void setJdbcDriverName(List<String> jdbcDriverName) {
this.jdbcDriverName = jdbcDriverName;
}
interface Callback<D> {
/**

View File

@ -17,6 +17,7 @@
package com.alibaba.nacos.plugin.auth.impl.persistence.handler;
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;
@ -66,6 +67,8 @@ public class PageHandlerAdapterFactory {
* init handler adapters.
*/
private void initHandlerAdapters() {
//Dm
addHandlerAdapter(new DmPageHandlerAdapter());
// MysqlPageHandlerAdapter
addHandlerAdapter(new MysqlPageHandlerAdapter());
// DerbyPageHandlerAdapter

View File

@ -0,0 +1,55 @@
/*
* Copyright 1999-2023 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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;
/**
* Dm page handler adapter.
*/
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<Object> newArgsList = new ArrayList<>(Arrays.asList(arg));
newArgsList.add((pageNo - 1) * pageSize);
newArgsList.add(pageSize);
Object[] newArgs = newArgsList.toArray(new Object[0]);
return new OffsetFetchResult(fetchSql, newArgs);
}
return new OffsetFetchResult(fetchSql, arg);
}
}

View File

@ -26,4 +26,7 @@ public class DataSourceConstant {
public static final String MYSQL = "mysql";
public static final String DERBY = "derby";
public static final String DM = "dm";
}

View File

@ -0,0 +1,55 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.plugin.datasource.impl.dm;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.plugin.datasource.constants.DataSourceConstant;
import com.alibaba.nacos.plugin.datasource.constants.FieldConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoAggrMapper;
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;
import java.util.List;
/**
* The mysql implementation of ConfigInfoAggrMapper.
*
* @author hyx
**/
public class ConfigInfoAggrMapperByDm extends AbstractMapper implements ConfigInfoAggrMapper {
@Override
public MapperResult findConfigInfoAggrByPageFetchRows(MapperContext context) {
int startRow = context.getStartRow();
int pageSize = context.getPageSize();
String dataId = (String) context.getWhereParameter(FieldConstant.DATA_ID);
String groupId = (String) context.getWhereParameter(FieldConstant.GROUP_ID);
String tenantId = (String) context.getWhereParameter(FieldConstant.TENANT_ID);
String sql =
"SELECT data_id,group_id,tenant_id,datum_id,app_name,content FROM config_info_aggr WHERE data_id= ? AND "
+ "group_id= ? AND tenant_id= ? ORDER BY datum_id LIMIT " + startRow + "," + pageSize;
List<Object> paramList = CollectionUtils.list(dataId, groupId, tenantId);
return new MapperResult(sql, paramList);
}
@Override
public String getDataSource() {
return DataSourceConstant.DM;
}
}

View File

@ -0,0 +1,54 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.plugin.datasource.impl.dm;
import com.alibaba.nacos.plugin.datasource.constants.DataSourceConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoBetaMapper;
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;
import java.util.ArrayList;
import java.util.List;
/**
* The mysql implementation of ConfigInfoBetaMapper.
*
* @author hyx
**/
public class ConfigInfoBetaMapperByDm extends AbstractMapper implements ConfigInfoBetaMapper {
@Override
public MapperResult findAllConfigInfoBetaForDumpAllFetchRows(MapperContext context) {
int startRow = context.getStartRow();
int pageSize = context.getPageSize();
String sql = " SELECT t.id,data_id,group_id,tenant_id,app_name,content,md5,gmt_modified,beta_ips,encrypted_data_key "
+ " FROM ( SELECT id FROM config_info_beta ORDER BY id LIMIT " + startRow + "," + pageSize + " )"
+ " g, config_info_beta t WHERE g.id = t.id ";
List<Object> paramList = new ArrayList<>();
paramList.add(startRow);
paramList.add(pageSize);
return new MapperResult(sql, paramList);
}
@Override
public String getDataSource() {
return DataSourceConstant.DM;
}
}

View File

@ -0,0 +1,277 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.plugin.datasource.impl.dm;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.NamespaceUtil;
import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.plugin.datasource.constants.DataSourceConstant;
import com.alibaba.nacos.plugin.datasource.constants.FieldConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoMapper;
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* The mysql implementation of ConfigInfoMapper.
*
* @author hyx
**/
public class ConfigInfoMapperByDm extends AbstractMapper implements ConfigInfoMapper {
private static final String DATA_ID = "dataId";
private static final String GROUP = "group";
private static final String APP_NAME = "appName";
private static final String CONTENT = "content";
private static final String TENANT = "tenant";
@Override
public MapperResult findConfigInfoByAppFetchRows(MapperContext context) {
final String appName = (String) context.getWhereParameter(FieldConstant.APP_NAME);
final String tenantId = (String) context.getWhereParameter(FieldConstant.TENANT_ID);
String sql = "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info"
+ " WHERE tenant_id LIKE ? AND app_name= ?" + " LIMIT " + context.getStartRow() + ","
+ context.getPageSize();
return new MapperResult(sql, CollectionUtils.list(tenantId, appName));
}
@Override
public MapperResult getTenantIdList(MapperContext context) {
String sql = "SELECT tenant_id FROM config_info WHERE tenant_id != '" + NamespaceUtil.getNamespaceDefaultId()
+ "' GROUP BY tenant_id LIMIT " + context.getStartRow() + "," + context.getPageSize();
return new MapperResult(sql, Collections.emptyList());
}
@Override
public MapperResult getGroupIdList(MapperContext context) {
String sql = "SELECT group_id FROM config_info WHERE tenant_id ='" + NamespaceUtil.getNamespaceDefaultId()
+ "' GROUP BY group_id LIMIT " + context.getStartRow() + "," + context.getPageSize();
return new MapperResult(sql, Collections.emptyList());
}
@Override
public MapperResult findAllConfigKey(MapperContext context) {
String sql = " SELECT data_id,group_id,app_name FROM ( "
+ " SELECT id FROM config_info WHERE tenant_id LIKE ? ORDER BY id LIMIT " + context.getStartRow() + ","
+ context.getPageSize() + " )" + " g, config_info t WHERE g.id = t.id ";
return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.TENANT_ID)));
}
@Override
public MapperResult findAllConfigInfoBaseFetchRows(MapperContext context) {
String appName = (String) context.getWhereParameter(FieldConstant.APP_NAME);
final String tenantId = (String) context.getWhereParameter(FieldConstant.TENANT_ID);
String sql = "SELECT t.id,data_id,group_id,content,md5"
+ " FROM ( SELECT id FROM config_info ORDER BY id LIMIT ?,? ) "
+ " g, config_info t WHERE g.id = t.id ";
return new MapperResult(sql, Collections.emptyList());
}
@Override
public MapperResult findAllConfigInfoFragment(MapperContext context) {
String sql = "SELECT id,data_id,group_id,tenant_id,app_name,content,md5,gmt_modified,type,encrypted_data_key "
+ "FROM config_info WHERE id > ? ORDER BY id ASC LIMIT " + context.getStartRow() + ","
+ context.getPageSize();
return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.ID)));
}
@Override
public MapperResult findChangeConfigFetchRows(MapperContext context) {
final String tenant = (String) context.getWhereParameter(FieldConstant.TENANT_ID);
final String dataId = (String) context.getWhereParameter(FieldConstant.DATA_ID);
final String group = (String) context.getWhereParameter(FieldConstant.GROUP_ID);
final String appName = (String) context.getWhereParameter(FieldConstant.APP_NAME);
final String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant;
final Timestamp startTime = (Timestamp) context.getWhereParameter(FieldConstant.START_TIME);
final Timestamp endTime = (Timestamp) context.getWhereParameter(FieldConstant.END_TIME);
List<Object> paramList = new ArrayList<>();
final String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,app_name,content,type,md5,gmt_modified FROM config_info WHERE ";
String where = " 1=1 ";
if (!StringUtils.isBlank(dataId)) {
where += " AND data_id LIKE ? ";
paramList.add(dataId);
}
if (!StringUtils.isBlank(group)) {
where += " AND group_id LIKE ? ";
paramList.add(group);
}
if (!StringUtils.isBlank(tenantTmp)) {
where += " AND tenant_id = ? ";
paramList.add(tenantTmp);
}
if (!StringUtils.isBlank(appName)) {
where += " AND app_name = ? ";
paramList.add(appName);
}
if (startTime != null) {
where += " AND gmt_modified >=? ";
paramList.add(startTime);
}
if (endTime != null) {
where += " AND gmt_modified <=? ";
paramList.add(endTime);
}
return new MapperResult(
sqlFetchRows + where + " AND id > " + context.getWhereParameter(FieldConstant.LAST_MAX_ID)
+ " ORDER BY id ASC" + " LIMIT " + 0 + "," + context.getPageSize(), paramList);
}
@Override
public MapperResult listGroupKeyMd5ByPageFetchRows(MapperContext context) {
String sql = "SELECT t.id,data_id,group_id,tenant_id,app_name,md5,type,gmt_modified,encrypted_data_key FROM "
+ "( SELECT id FROM config_info ORDER BY id LIMIT " + context.getStartRow() + ","
+ context.getPageSize() + " ) g, config_info t WHERE g.id = t.id";
return new MapperResult(sql, Collections.emptyList());
}
@Override
public MapperResult findConfigInfoBaseLikeFetchRows(MapperContext context) {
final String dataId = (String) context.getWhereParameter(FieldConstant.DATA_ID);
final String group = (String) context.getWhereParameter(FieldConstant.GROUP_ID);
final String content = (String) context.getWhereParameter(FieldConstant.CONTENT);
final String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,content FROM config_info WHERE ";
String where = " 1=1 AND tenant_id='" + NamespaceUtil.getNamespaceDefaultId() + "' ";
List<Object> paramList = new ArrayList<>();
if (!StringUtils.isBlank(dataId)) {
where += " AND data_id LIKE ? ";
paramList.add(dataId);
}
if (!StringUtils.isBlank(group)) {
where += " AND group_id LIKE ";
paramList.add(group);
}
if (!StringUtils.isBlank(content)) {
where += " AND content LIKE ? ";
paramList.add(content);
}
return new MapperResult(sqlFetchRows + where + " LIMIT " + context.getStartRow() + "," + context.getPageSize(),
paramList);
}
@Override
public MapperResult findConfigInfo4PageFetchRows(MapperContext context) {
final String tenant = (String) context.getWhereParameter(FieldConstant.TENANT_ID);
final String dataId = (String) context.getWhereParameter(FieldConstant.DATA_ID);
final String group = (String) context.getWhereParameter(FieldConstant.GROUP_ID);
final String appName = (String) context.getWhereParameter(FieldConstant.APP_NAME);
final String content = (String) context.getWhereParameter(FieldConstant.CONTENT);
List<Object> paramList = new ArrayList<>();
final String sql = "SELECT id,data_id,group_id,tenant_id,app_name,content,type,encrypted_data_key FROM config_info";
StringBuilder where = new StringBuilder(" WHERE ");
where.append(" tenant_id=? ");
paramList.add(tenant);
if (StringUtils.isNotBlank(dataId)) {
where.append(" AND data_id=? ");
paramList.add(dataId);
}
if (StringUtils.isNotBlank(group)) {
where.append(" AND group_id=? ");
paramList.add(group);
}
if (StringUtils.isNotBlank(appName)) {
where.append(" AND app_name=? ");
paramList.add(appName);
}
if (!StringUtils.isBlank(content)) {
where.append(" AND content LIKE ? ");
paramList.add(content);
}
return new MapperResult(sql + where + " LIMIT " + context.getStartRow() + "," + context.getPageSize(),
paramList);
}
@Override
public MapperResult findConfigInfoBaseByGroupFetchRows(MapperContext context) {
String sql = "SELECT id,data_id,group_id,content FROM config_info WHERE group_id=? AND tenant_id=?" + " LIMIT "
+ context.getStartRow() + "," + context.getPageSize();
return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.GROUP_ID),
context.getWhereParameter(FieldConstant.TENANT_ID)));
}
@Override
public MapperResult findConfigInfoLike4PageFetchRows(MapperContext context) {
final String tenant = (String) context.getWhereParameter(FieldConstant.TENANT_ID);
final String dataId = (String) context.getWhereParameter(FieldConstant.DATA_ID);
final String group = (String) context.getWhereParameter(FieldConstant.GROUP_ID);
final String appName = (String) context.getWhereParameter(FieldConstant.APP_NAME);
final String content = (String) context.getWhereParameter(FieldConstant.CONTENT);
List<Object> paramList = new ArrayList<>();
final String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,app_name,content,encrypted_data_key FROM config_info";
StringBuilder where = new StringBuilder(" WHERE ");
where.append(" tenant_id LIKE ? ");
paramList.add(tenant);
if (!StringUtils.isBlank(dataId)) {
where.append(" AND data_id LIKE ? ");
paramList.add(dataId);
}
if (!StringUtils.isBlank(group)) {
where.append(" AND group_id LIKE ? ");
paramList.add(group);
}
if (!StringUtils.isBlank(appName)) {
where.append(" AND app_name = ? ");
paramList.add(appName);
}
if (!StringUtils.isBlank(content)) {
where.append(" AND content LIKE ? ");
paramList.add(content);
}
return new MapperResult(sqlFetchRows + where + " LIMIT " + context.getStartRow() + "," + context.getPageSize(),
paramList);
}
@Override
public MapperResult findAllConfigInfoFetchRows(MapperContext context) {
String sql = "SELECT t.id,data_id,group_id,tenant_id,app_name,content,md5 "
+ " FROM ( SELECT id FROM config_info WHERE tenant_id LIKE ? ORDER BY id LIMIT ?,? )"
+ " g, config_info t WHERE g.id = t.id ";
return new MapperResult(sql,
CollectionUtils.list(context.getWhereParameter(FieldConstant.TENANT_ID), context.getStartRow(),
context.getPageSize()));
}
@Override
public String getDataSource() {
return DataSourceConstant.DM;
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.plugin.datasource.impl.dm;
import com.alibaba.nacos.plugin.datasource.constants.DataSourceConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoTagMapper;
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;
import java.util.Collections;
/**
* The mysql implementation of ConfigInfoTagMapper.
*
* @author hyx
**/
public class ConfigInfoTagMapperByDm extends AbstractMapper implements ConfigInfoTagMapper {
@Override
public MapperResult findAllConfigInfoTagForDumpAllFetchRows(MapperContext context) {
String sql = " SELECT t.id,data_id,group_id,tenant_id,tag_id,app_name,content,md5,gmt_modified "
+ " FROM ( SELECT id FROM config_info_tag ORDER BY id LIMIT " + context.getStartRow() + ","
+ context.getPageSize() + " ) " + "g, config_info_tag t WHERE g.id = t.id ";
return new MapperResult(sql, Collections.emptyList());
}
@Override
public String getDataSource() {
return DataSourceConstant.DM;
}
}

View File

@ -0,0 +1,136 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.plugin.datasource.impl.dm;
import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.plugin.datasource.constants.DataSourceConstant;
import com.alibaba.nacos.plugin.datasource.constants.FieldConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.ConfigTagsRelationMapper;
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;
import java.util.ArrayList;
import java.util.List;
/**
* The mysql implementation of ConfigTagsRelationMapper.
*
* @author hyx
**/
public class ConfigTagsRelationMapperByDm extends AbstractMapper implements ConfigTagsRelationMapper {
@Override
public MapperResult findConfigInfo4PageFetchRows(MapperContext context) {
final String tenant = (String) context.getWhereParameter(FieldConstant.TENANT_ID);
final String dataId = (String) context.getWhereParameter(FieldConstant.DATA_ID);
final String group = (String) context.getWhereParameter(FieldConstant.GROUP_ID);
final String appName = (String) context.getWhereParameter(FieldConstant.APP_NAME);
final String content = (String) context.getWhereParameter(FieldConstant.CONTENT);
final String[] tagArr = (String[]) context.getWhereParameter(FieldConstant.TAG_ARR);
List<Object> paramList = new ArrayList<>();
StringBuilder where = new StringBuilder(" WHERE ");
final String sql =
"SELECT a.id,a.data_id,a.group_id,a.tenant_id,a.app_name,a.content FROM config_info a LEFT JOIN "
+ "config_tags_relation b ON a.id=b.id";
where.append(" a.tenant_id=? ");
paramList.add(tenant);
if (StringUtils.isNotBlank(dataId)) {
where.append(" AND a.data_id=? ");
paramList.add(dataId);
}
if (StringUtils.isNotBlank(group)) {
where.append(" AND a.group_id=? ");
paramList.add(group);
}
if (StringUtils.isNotBlank(appName)) {
where.append(" AND a.app_name=? ");
paramList.add(appName);
}
if (!StringUtils.isBlank(content)) {
where.append(" AND a.content LIKE ? ");
paramList.add(content);
}
where.append(" AND b.tag_name IN (");
for (int i = 0; i < tagArr.length; i++) {
if (i != 0) {
where.append(", ");
}
where.append('?');
paramList.add(tagArr[i]);
}
where.append(") ");
return new MapperResult(sql + where + " LIMIT " + context.getStartRow() + "," + context.getPageSize(),
paramList);
}
@Override
public MapperResult findConfigInfoLike4PageFetchRows(MapperContext context) {
final String tenant = (String) context.getWhereParameter(FieldConstant.TENANT_ID);
final String dataId = (String) context.getWhereParameter(FieldConstant.DATA_ID);
final String group = (String) context.getWhereParameter(FieldConstant.GROUP_ID);
final String appName = (String) context.getWhereParameter(FieldConstant.APP_NAME);
final String content = (String) context.getWhereParameter(FieldConstant.CONTENT);
final String[] tagArr = (String[]) context.getWhereParameter(FieldConstant.TAG_ARR);
List<Object> paramList = new ArrayList<>();
StringBuilder where = new StringBuilder(" WHERE ");
final String sqlFetchRows = "SELECT a.id,a.data_id,a.group_id,a.tenant_id,a.app_name,a.content "
+ "FROM config_info a LEFT JOIN config_tags_relation b ON a.id=b.id ";
where.append(" a.tenant_id LIKE ? ");
paramList.add(tenant);
if (!StringUtils.isBlank(dataId)) {
where.append(" AND a.data_id LIKE ? ");
paramList.add(dataId);
}
if (!StringUtils.isBlank(group)) {
where.append(" AND a.group_id LIKE ? ");
paramList.add(group);
}
if (!StringUtils.isBlank(appName)) {
where.append(" AND a.app_name = ? ");
paramList.add(appName);
}
if (!StringUtils.isBlank(content)) {
where.append(" AND a.content LIKE ? ");
paramList.add(content);
}
where.append(" AND b.tag_name IN (");
for (int i = 0; i < tagArr.length; i++) {
if (i != 0) {
where.append(", ");
}
where.append('?');
paramList.add(tagArr[i]);
}
where.append(") ");
return new MapperResult(sqlFetchRows + where + " LIMIT " + context.getStartRow() + "," + context.getPageSize(),
paramList);
}
@Override
public String getDataSource() {
return DataSourceConstant.DM;
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.plugin.datasource.impl.dm;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.plugin.datasource.constants.DataSourceConstant;
import com.alibaba.nacos.plugin.datasource.constants.FieldConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.GroupCapacityMapper;
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;
/**
* The derby implementation of {@link GroupCapacityMapper}.
*
* @author lixiaoshuang
*/
public class GroupCapacityMapperByDm extends AbstractMapper implements GroupCapacityMapper {
@Override
public String getDataSource() {
return DataSourceConstant.DM;
}
@Override
public MapperResult selectGroupInfoBySize(MapperContext context) {
String sql = "SELECT id, group_id FROM group_capacity WHERE id > ? LIMIT ?";
return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.ID), context.getPageSize()));
}
}

View File

@ -0,0 +1,56 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.plugin.datasource.impl.dm;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.plugin.datasource.constants.DataSourceConstant;
import com.alibaba.nacos.plugin.datasource.constants.FieldConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.HistoryConfigInfoMapper;
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;
/**
* The mysql implementation of HistoryConfigInfoMapper.
*
* @author hyx
**/
public class HistoryConfigInfoMapperByDm extends AbstractMapper implements HistoryConfigInfoMapper {
@Override
public MapperResult removeConfigHistory(MapperContext context) {
String sql = "DELETE FROM his_config_info WHERE gmt_modified < ? LIMIT ?";
return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.START_TIME),
context.getWhereParameter(FieldConstant.LIMIT_SIZE)));
}
@Override
public MapperResult pageFindConfigHistoryFetchRows(MapperContext context) {
String sql =
"SELECT nid,data_id,group_id,tenant_id,app_name,src_ip,src_user,op_type,gmt_create,gmt_modified FROM his_config_info "
+ "WHERE data_id = ? AND group_id = ? AND tenant_id = ? ORDER BY nid DESC LIMIT "
+ context.getStartRow() + "," + context.getPageSize();
return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.DATA_ID),
context.getWhereParameter(FieldConstant.GROUP_ID), context.getWhereParameter(FieldConstant.TENANT_ID)));
}
@Override
public String getDataSource() {
return DataSourceConstant.DM;
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.plugin.datasource.impl.dm;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.plugin.datasource.constants.DataSourceConstant;
import com.alibaba.nacos.plugin.datasource.constants.FieldConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.TenantCapacityMapper;
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;
/**
* The mysql implementation of TenantCapacityMapper.
*
* @author hyx
**/
public class TenantCapacityMapperByDm extends AbstractMapper implements TenantCapacityMapper {
@Override
public String getDataSource() {
return DataSourceConstant.DM;
}
@Override
public MapperResult getCapacityList4CorrectUsage(MapperContext context) {
String sql = "SELECT id, tenant_id FROM tenant_capacity WHERE id>? LIMIT ?";
return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.ID),
context.getWhereParameter(FieldConstant.LIMIT_SIZE)));
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.plugin.datasource.impl.dm;
import com.alibaba.nacos.plugin.datasource.constants.DataSourceConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.TenantInfoMapper;
/**
* The mysql implementation of TenantInfoMapper.
*
* @author hyx
**/
public class TenantInfoMapperByDm extends AbstractMapper implements TenantInfoMapper {
@Override
public String getDataSource() {
return DataSourceConstant.DM;
}
}

View File

@ -13,6 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
com.alibaba.nacos.plugin.datasource.impl.dm.ConfigInfoAggrMapperByDm
com.alibaba.nacos.plugin.datasource.impl.dm.ConfigInfoBetaMapperByDm
com.alibaba.nacos.plugin.datasource.impl.dm.ConfigInfoMapperByDm
com.alibaba.nacos.plugin.datasource.impl.dm.ConfigInfoTagMapperByDm
com.alibaba.nacos.plugin.datasource.impl.dm.ConfigTagsRelationMapperByDm
com.alibaba.nacos.plugin.datasource.impl.dm.HistoryConfigInfoMapperByDm
com.alibaba.nacos.plugin.datasource.impl.dm.TenantInfoMapperByDm
com.alibaba.nacos.plugin.datasource.impl.dm.TenantCapacityMapperByDm
com.alibaba.nacos.plugin.datasource.impl.dm.GroupCapacityMapperByDm
com.alibaba.nacos.plugin.datasource.impl.mysql.ConfigInfoAggrMapperByMySql
com.alibaba.nacos.plugin.datasource.impl.mysql.ConfigInfoBetaMapperByMySql

View File

@ -32,7 +32,7 @@ import java.util.Arrays;
import java.util.List;
@RunWith(JUnit4.class)
public class ConfigInfoAggrMapperByMySqlTest {
public class ConfigInfoAggrMapperByDmTest {
private ConfigInfoAggrMapperByMySql configInfoAggrMapperByMySql;

View File

@ -30,7 +30,7 @@ import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
public class ConfigInfoBetaMapperByMySqlTest {
public class ConfigInfoBetaMapperByDmTest {
private ConfigInfoBetaMapperByMySql configInfoBetaMapperByMySql;

View File

@ -30,7 +30,7 @@ import org.junit.Test;
import java.sql.Timestamp;
import java.util.List;
public class ConfigInfoMapperByMySqlTest {
public class ConfigInfoMapperByDmTest {
private ConfigInfoMapperByMySql configInfoMapperByMySql;

View File

@ -29,7 +29,7 @@ import org.junit.Test;
import java.sql.Timestamp;
import java.util.List;
public class ConfigInfoTagMapperByMySqlTest {
public class ConfigInfoTagMapperByDmTest {
private ConfigInfoTagMapperByMySql configInfoTagMapperByMySql;

View File

@ -29,7 +29,7 @@ import org.junit.Test;
import java.util.Arrays;
import java.util.List;
public class ConfigTagsRelationMapperByMySqlTest {
public class ConfigTagsRelationMapperByDmTest {
private ConfigTagsRelationMapperByMySql configTagsRelationMapperByMySql;

View File

@ -27,7 +27,7 @@ import org.junit.Test;
import java.sql.Timestamp;
public class GroupCapacityMapperByMysqlTest {
public class GroupCapacityMapperByDmTest {
private GroupCapacityMapperByMysql groupCapacityMapperByMysql;

View File

@ -27,7 +27,7 @@ import org.junit.Test;
import java.sql.Timestamp;
public class HistoryConfigInfoMapperByMySqlTest {
public class HistoryConfigInfoMapperByDmTest {
private HistoryConfigInfoMapperByMySql historyConfigInfoMapperByMySql;

View File

@ -27,7 +27,7 @@ import org.junit.Test;
import java.sql.Timestamp;
public class TenantCapacityMapperByMySqlTest {
public class TenantCapacityMapperByDmTest {
private TenantCapacityMapperByMySql tenantCapacityMapperByMySql;

View File

@ -22,7 +22,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class TenantInfoMapperByMySqlTest {
public class TenantInfoMapperByDmTest {
private TenantInfoMapperByMySql tenantInfoMapperByMySql;

View File

@ -150,6 +150,7 @@
<jraft-core.version>1.3.12</jraft-core.version>
<rpc-grpc-impl.version>${jraft-core.version}</rpc-grpc-impl.version>
<SnakeYaml.version>2.0</SnakeYaml.version>
<dm-jdbc.version>1.8</dm-jdbc.version>
</properties>
<!-- == -->
<!-- =========================================================Build plugins================================================ -->
@ -616,7 +617,11 @@
<!-- Default dependencies in all subprojects -->
<dependencies>
<dependency>
<groupId>dm.jdbc</groupId>
<artifactId>DmJdbcDriver</artifactId>
<version>${dm-jdbc.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>