nacos 2.4.0.1 源码编译,适配达梦dm数据库

参考资料: 

Nacos 快速开始  

nacos适配达梦数据库

Nacos2.2.3适配达梦数据库编译打包完整教程

gitee代码

nacos适配达梦、人大金仓数据库

Nacos集成达梦数据库

nacos适配达梦数据库_nacos连接达梦数据库

2.4.0取消管理员用户nacos的默认密码

一、编译nacos源码,并运行

1. 下载nacos代码

github nacos 仓库地址:nacos

本文以2.4.0.1演示,github操作如下

选择Tags  2.4.0.1

解压nacos-2.4.0.1.zip到nacos-2.4.0.1,并用idea打开

2. 编译代码

maven clean install 

如果遇到以下错误信息,如上图

protoc did not exit cleanly. Review output for more information.

重启idea,清除缓存

源码下载下来会出现找不到 istio.mcp.v1alpha1.MetadataOuterClass.Metadata,istio.networking.v1alpha3.ServiceEntryOuterClass.ServiceEntry;
解决的办法:在父项目目录下执行mvn clean compile '-Dmaven.test.skip=true' 命令。

启动Nacos类

com.alibaba.nacos.Nacos

如果报以下错

类 com.alibaba.nacos.consistency.ConsistencyProtocol 包找不到信息

import com.alibaba.nacos.consistency.entity.ReadRequest;
import com.alibaba.nacos.consistency.entity.Response;
import com.alibaba.nacos.consistency.entity.WriteRequest;

控制台报错误信息

com.alibaba.nacos.consistency.ConsistencyProtocol

D:\work\opensource\nacos-2.4.0.1\consistency\src\main\java\com\alibaba\nacos\consistency\ConsistencyProtocol.java:19:44
java: 程序包com.alibaba.nacos.consistency.entity不存在

解决办法:找到右面maven里面的 nacos-consistency-2.4.0,执行compile编译

如果com.alibaba.nacos.istio.model.ServiceEntryWrapper报错找不到如下两个包

import istio.mcp.v1alpha1.MetadataOuterClass.Metadata;
import istio.networking.v1alpha3.ServiceEntryOuterClass.ServiceEntry;

解决办法:执行下图中的 nacos-istio模块的compile

还是不行尝试重启idea(本文这种方式解决,未知原因

解决所有问题后,

mvn clean  install 或执行idea是maven面板的 Alibaba NACOS 2.4.0里面的clean 和 install完成编译

3. 启动Nacos

启动  com.alibaba.nacos.Nacos

如果报错 java.net.UnknownHostException: jmenv.tbsite.net

报错参考: Nacos启动时报错 java.net.UnknownHostException: jmenv.tbsite.net

如下内容:

NacosException: java.net.UnknownHostException: jmenv.tbsite.net

问题描述
启动过程中出现报错,错误:java.net.UnknownHostException: jmenv.tbsite.net

原因分析:

Nacos默认是以集群(cluster)启动,实际情况是单机,所以在启动的时候设置为单机模式启动,则能正常启动。

解决方案:
windows启动:

startup.cmd -m standalone

linux启动:

startup.sh -m standalone

下载的是zip release版本 需指定参数 sh startup.sh -m standalone


二、适配达梦数据库(DM)

1. nacos 达梦插件仓库

参考资料 nacos.io 

多数据源插件icon-default.png?t=O83Ahttps://nacos.io/docs/latest/plugin/datasource-plugin/

nacos 能否支持达梦数据库icon-default.png?t=O83Ahttps://nacos.io/blog/faq/nacos-user-question-history11194/

上图中的nacos插件仓库就是下面的链接

GitHub - nacos-group/nacos-plugin: A collection of Nacos plug-ins, providing Nacos with pluggable plug-in capabilities, support for user customization and high scalability

查看nacos-plugin库里面有没有提供dm的代码,经查看在develop分支有dm代码

https://github.com/nacos-group/nacos-plugin

可以看到在develop分支上有dm的数据库相关代码

下载源码,后面将对应的dm源码拷贝到自己的nacos源码中

方法一:git clone 


方法二:下载压缩包(指定分支或者指定tag) 

本文下载develop分支nacos-plugin-develop.zip

并解压,idea打开。

2. nacos数据源插件部分代码

nacos-datasource-plugin-ext结构

nacos-datasource-plugin-ext-base

nacos-dm-datasource-plugin-ext

3. nacos源码添加达梦数据源相关代码

将上面达梦代码复制到nacos源代码中

nacos-2.4.0.1代码plugin>datasource里面只有derby和mysql相关的代码

根据插件代码添加相关代码

com.alibaba.nacos.plugin.datasource.constants包
DatabaseTypeConstant.java
PrimaryKeyConstant.java

com.alibaba.nacos.plugin.datasource.dialect包
AbstractDatabaseDialect.java
DaMengDatabaseDialect.java
DatabaseDialect.java
DefaultDatabaseDialect.java

com.alibaba.nacos.plugin.datasource.impl.base包
BaseConfigInfoAggrMapper.java
BaseConfigInfoBetaMapper.java
BaseConfigInfoMapper.java
BaseConfigInfoTagMapper.java
BaseConfigTagsRelationMapper.java
BaseGroupCapacityMapper.java
BaseTenantCapacityMapper.java
BaseTenantInfoMapper.java

com.alibaba.nacos.plugin.datasource.impl.dm包
ConfigInfoAggrMapperByDaMeng.java
ConfigInfoBetaMapperByDaMeng.java
ConfigInfoMapperByDaMeng.java
ConfigInfoTagMapperByDaMeng.java
ConfigTagsRelationMapperByDaMeng.java
GroupCapacityMapperByDaMeng.java
HistoryConfigInfoMapperByDaMeng.java
TenantCapacityMapperByDaMeng.java
TenantInfoMapperByDaMeng.java


com.alibaba.nacos.plugin.datasource.manager包
DatabaseDialectManager.java

com.alibaba.nacos.plugin.datasource.dialect.DatabaseDialect

com.alibaba.nacos.plugin.datasource.dialect.DaMengDatabaseDialect

com.alibaba.nacos.plugin.datasource.mapper.Mapper

com.alibaba.nacos.plugin.datasource.impl.dm.ConfigInfoAggrMapperByDaMeng
com.alibaba.nacos.plugin.datasource.impl.dm.ConfigInfoBetaMapperByDaMeng
com.alibaba.nacos.plugin.datasource.impl.dm.ConfigInfoMapperByDaMeng
com.alibaba.nacos.plugin.datasource.impl.dm.ConfigInfoTagMapperByDaMeng
com.alibaba.nacos.plugin.datasource.impl.dm.ConfigTagsRelationMapperByDaMeng
com.alibaba.nacos.plugin.datasource.impl.dm.HistoryConfigInfoMapperByDaMeng
com.alibaba.nacos.plugin.datasource.impl.dm.TenantInfoMapperByDaMeng
com.alibaba.nacos.plugin.datasource.impl.dm.TenantCapacityMapperByDaMeng
com.alibaba.nacos.plugin.datasource.impl.dm.GroupCapacityMapperByDaMeng

nacos-common模块pom.xml文件中添加达梦依赖

        <dependency>
            <groupId>com.dameng</groupId>
            <artifactId>DmJdbcDriver18</artifactId>
        </dependency>

nacos-all模块pom.xml文件中添加达梦依赖 

<dependency>
    <groupId>com.dameng</groupId>
    <artifactId>DmJdbcDriver18</artifactId>
    <version>${dm-connector-java.version}</version>
</dependency>

nacos-all pom.xml文件<properties>标签中添加 达梦版本号

<dm-connector-java.version>8.1.1.193</dm-connector-java.version>

4. 如果还是有问题,清空缓存,重启idea

cleanLastUpdated mavenrepository.bat

@echo off
rem create by xxx
  
rem 这里写你的仓库路径
set REPOSITORY_PATH=D:\maven\xxx\xxxxrepository
rem 正在搜索...
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%\*lastUpdated*"') do (
    echo %%i
    del /s /q "%%i"
)
rem 搜索完毕
pause

repositories_mavenrepository1.bat

@echo off
set REPOSITORY_PATH=D:\maven\xxxx\xxxrepository
rem 正在搜索...
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%\*.repositories*"') do (
    del /s /q %%i
)
rem 搜索完毕
pause

 启动成功

5. nacos-plugin-develop代码里面有达梦数据库sql语句

6. 新建达梦数据库表空间

NACOS_2_4_0_1_DATA

NACOS_2_4_0_1_INDEX

7. 新建达梦数据库用户

新建用户 NACOS_2_4_0_1 ,选择表空间和索引表空间

查看用户

 

8. 新建nacos表

nacos建表语句,DM sql语句,数据库名(模式名):NACOS_2_4_0_1

CREATE TABLE "NACOS_2_4_0_1"."USERS"
(
    "USERNAME" VARCHAR(50)  NOT NULL,
    "PASSWORD" VARCHAR(500) NOT NULL,
    "ENABLED"  TINYINT      NOT NULL
);
CREATE TABLE "NACOS_2_4_0_1"."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 "NACOS_2_4_0_1"."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 "NACOS_2_4_0_1"."ROLES"
(
    "USERNAME" VARCHAR(50) NOT NULL,
    "ROLE"     VARCHAR(50) NOT NULL
);
CREATE TABLE "NACOS_2_4_0_1"."PERMISSIONS"
(
    "ROLE"     VARCHAR(50)  NOT NULL,
    "RESOURCE" VARCHAR(255) NOT NULL,
    "ACTION"   VARCHAR(8)   NOT NULL
);
CREATE TABLE "NACOS_2_4_0_1"."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 "NACOS_2_4_0_1"."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 "NACOS_2_4_0_1"."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 "NACOS_2_4_0_1"."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 "NACOS_2_4_0_1"."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 "NACOS_2_4_0_1"."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 "NACOS_2_4_0_1"."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
);
ALTER TABLE "NACOS_2_4_0_1"."USERS"
    ADD CONSTRAINT PRIMARY KEY ("USERNAME");

ALTER TABLE "NACOS_2_4_0_1"."TENANT_INFO"
    ADD CONSTRAINT PRIMARY KEY ("ID");

ALTER TABLE "NACOS_2_4_0_1"."TENANT_INFO"
    ADD CONSTRAINT "UK_TENANT_INFO_KPTENANTID" UNIQUE ("KP", "TENANT_ID");

ALTER TABLE "NACOS_2_4_0_1"."TENANT_CAPACITY"
    ADD CONSTRAINT PRIMARY KEY ("ID");

ALTER TABLE "NACOS_2_4_0_1"."TENANT_CAPACITY"
    ADD CONSTRAINT "UK_TENANT_ID" UNIQUE ("TENANT_ID");

ALTER TABLE "NACOS_2_4_0_1"."ROLES"
    ADD CONSTRAINT "IDX_USER_ROLE" UNIQUE ("USERNAME", "ROLE");

ALTER TABLE "NACOS_2_4_0_1"."PERMISSIONS"
    ADD CONSTRAINT "UK_ROLE_PERMISSION" UNIQUE ("ROLE", "RESOURCE", "ACTION");

ALTER TABLE "NACOS_2_4_0_1"."HIS_CONFIG_INFO"
    ADD CONSTRAINT PRIMARY KEY ("NID");

ALTER TABLE "NACOS_2_4_0_1"."GROUP_CAPACITY"
    ADD CONSTRAINT PRIMARY KEY ("ID");

ALTER TABLE "NACOS_2_4_0_1"."GROUP_CAPACITY"
    ADD CONSTRAINT "UK_GROUP_ID" UNIQUE ("GROUP_ID");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_TAGS_RELATION"
    ADD CONSTRAINT PRIMARY KEY ("NID");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_TAGS_RELATION"
    ADD CONSTRAINT "UK_CONFIGTAGRELATION_CONFIGIDTAG" UNIQUE ("ID", "TAG_NAME", "TAG_TYPE");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_INFO_TAG"
    ADD CONSTRAINT PRIMARY KEY ("ID");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_INFO_TAG"
    ADD CONSTRAINT "UK_CONFIGINFOTAG_DATAGROUPTENANTTAG" UNIQUE ("DATA_ID", "GROUP_ID", "TENANT_ID", "TAG_ID");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_INFO_BETA"
    ADD CONSTRAINT PRIMARY KEY ("ID");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_INFO_BETA"
    ADD CONSTRAINT "UK_CONFIGINFOBETA_DATAGROUPTENANT" UNIQUE ("DATA_ID", "GROUP_ID", "TENANT_ID");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_INFO_AGGR"
    ADD CONSTRAINT PRIMARY KEY ("ID");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_INFO_AGGR"
    ADD CONSTRAINT "UK_CONFIGINFOAGGR_DATAGROUPTENANTDATUM" UNIQUE ("DATA_ID", "GROUP_ID", "TENANT_ID", "DATUM_ID");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_INFO"
    ADD CONSTRAINT PRIMARY KEY ("ID");

ALTER TABLE "NACOS_2_4_0_1"."CONFIG_INFO"
    ADD CONSTRAINT "UK_CONFIGINFO_DATAGROUPTENANT" UNIQUE ("DATA_ID", "GROUP_ID", "TENANT_ID");

CREATE INDEX "IDX_TENANT_ID"
    ON "NACOS_2_4_0_1"."TENANT_INFO" ("TENANT_ID");

COMMENT
ON TABLE "NACOS_2_4_0_1"."TENANT_INFO" IS 'tenant_info';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_INFO"."ID" IS 'id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_INFO"."KP" IS 'kp';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_INFO"."TENANT_ID" IS 'tenant_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_INFO"."TENANT_NAME" IS 'tenant_name';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_INFO"."TENANT_DESC" IS 'tenant_desc';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_INFO"."CREATE_SOURCE" IS 'create_source';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_INFO"."GMT_CREATE" IS '创建时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_INFO"."GMT_MODIFIED" IS '修改时间';

ALTER TABLE "NACOS_2_4_0_1"."TENANT_CAPACITY"
    ADD CHECK ("QUOTA" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."TENANT_CAPACITY"
    ADD CHECK ("MAX_HISTORY_COUNT" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."TENANT_CAPACITY"
    ADD CHECK ("MAX_AGGR_SIZE" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."TENANT_CAPACITY"
    ADD CHECK ("MAX_AGGR_COUNT" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."TENANT_CAPACITY"
    ADD CHECK ("MAX_SIZE" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."TENANT_CAPACITY"
    ADD CHECK ("USAGE" >= 0) ENABLE;

COMMENT
ON TABLE "NACOS_2_4_0_1"."TENANT_CAPACITY" IS '租户容量信息表';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."ID" IS '主键ID';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."TENANT_ID" IS 'Tenant ID';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."QUOTA" IS '配额,0表示使用默认值';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."USAGE" IS '使用量';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."MAX_SIZE" IS '单个配置大小上限,单位为字节,0表示使用默认值';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."MAX_AGGR_COUNT" IS '聚合子配置最大个数';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."MAX_AGGR_SIZE" IS '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."MAX_HISTORY_COUNT" IS '最大变更历史数量';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."GMT_CREATE" IS '创建时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."TENANT_CAPACITY"."GMT_MODIFIED" IS '修改时间';

ALTER TABLE "NACOS_2_4_0_1"."HIS_CONFIG_INFO"
    ADD CHECK ("ID" >= 0) ENABLE;

CREATE INDEX "IDX_GMT_MODIFIED"
    ON "NACOS_2_4_0_1"."HIS_CONFIG_INFO" ("GMT_MODIFIED");

CREATE INDEX "IDX_GMT_CREATE"
    ON "NACOS_2_4_0_1"."HIS_CONFIG_INFO" ("GMT_CREATE");

CREATE INDEX "IDX_DID"
    ON "NACOS_2_4_0_1"."HIS_CONFIG_INFO" ("DATA_ID");

COMMENT
ON TABLE "NACOS_2_4_0_1"."HIS_CONFIG_INFO" IS '多租户改造';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."HIS_CONFIG_INFO"."APP_NAME" IS 'app_name';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."HIS_CONFIG_INFO"."TENANT_ID" IS '租户字段';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."HIS_CONFIG_INFO"."ENCRYPTED_DATA_KEY" IS '密钥';

ALTER TABLE "NACOS_2_4_0_1"."GROUP_CAPACITY"
    ADD CHECK ("QUOTA" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."GROUP_CAPACITY"
    ADD CHECK ("MAX_HISTORY_COUNT" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."GROUP_CAPACITY"
    ADD CHECK ("MAX_AGGR_SIZE" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."GROUP_CAPACITY"
    ADD CHECK ("MAX_AGGR_COUNT" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."GROUP_CAPACITY"
    ADD CHECK ("MAX_SIZE" >= 0) ENABLE;

ALTER TABLE "NACOS_2_4_0_1"."GROUP_CAPACITY"
    ADD CHECK ("USAGE" >= 0) ENABLE;

COMMENT
ON TABLE "NACOS_2_4_0_1"."GROUP_CAPACITY" IS '集群、各Group容量信息表';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."ID" IS '主键ID';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."GROUP_ID" IS 'Group ID,空字符表示整个集群';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."QUOTA" IS '配额,0表示使用默认值';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."USAGE" IS '使用量';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."MAX_SIZE" IS '单个配置大小上限,单位为字节,0表示使用默认值';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."MAX_AGGR_COUNT" IS '聚合子配置最大个数,,0表示使用默认值';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."MAX_AGGR_SIZE" IS '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."MAX_HISTORY_COUNT" IS '最大变更历史数量';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."GMT_CREATE" IS '创建时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."GROUP_CAPACITY"."GMT_MODIFIED" IS '修改时间';

COMMENT
ON TABLE "NACOS_2_4_0_1"."CONFIG_TAGS_RELATION" IS 'config_tag_relation';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_TAGS_RELATION"."ID" IS 'id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_TAGS_RELATION"."TAG_NAME" IS 'tag_name';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_TAGS_RELATION"."TAG_TYPE" IS 'tag_type';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_TAGS_RELATION"."DATA_ID" IS 'data_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_TAGS_RELATION"."GROUP_ID" IS 'group_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_TAGS_RELATION"."TENANT_ID" IS 'tenant_id';

COMMENT
ON TABLE "NACOS_2_4_0_1"."CONFIG_INFO_TAG" IS 'config_info_tag';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."ID" IS 'id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."DATA_ID" IS 'data_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."GROUP_ID" IS 'group_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."TENANT_ID" IS 'tenant_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."TAG_ID" IS 'tag_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."APP_NAME" IS 'app_name';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."CONTENT" IS 'content';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."MD5" IS 'md5';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."GMT_CREATE" IS '创建时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."GMT_MODIFIED" IS '修改时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."SRC_USER" IS 'source user';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_TAG"."SRC_IP" IS 'source ip';

COMMENT
ON TABLE "NACOS_2_4_0_1"."CONFIG_INFO_BETA" IS 'config_info_beta';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."ID" IS 'id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."DATA_ID" IS 'data_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."GROUP_ID" IS 'group_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."APP_NAME" IS 'app_name';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."CONTENT" IS 'content';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."BETA_IPS" IS 'betaIps';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."MD5" IS 'md5';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."GMT_CREATE" IS '创建时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."GMT_MODIFIED" IS '修改时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."SRC_USER" IS 'source user';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."SRC_IP" IS 'source ip';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."TENANT_ID" IS '租户字段';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_BETA"."ENCRYPTED_DATA_KEY" IS '密钥';

COMMENT
ON TABLE "NACOS_2_4_0_1"."CONFIG_INFO_AGGR" IS '增加租户字段';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_AGGR"."ID" IS 'id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_AGGR"."DATA_ID" IS 'data_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_AGGR"."GROUP_ID" IS 'group_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_AGGR"."DATUM_ID" IS 'datum_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_AGGR"."CONTENT" IS '内容';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_AGGR"."GMT_MODIFIED" IS '修改时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO_AGGR"."TENANT_ID" IS '租户字段';

COMMENT
ON TABLE "NACOS_2_4_0_1"."CONFIG_INFO" IS 'config_info';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."ID" IS 'id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."DATA_ID" IS 'data_id';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."CONTENT" IS 'content';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."MD5" IS 'md5';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."GMT_CREATE" IS '创建时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."GMT_MODIFIED" IS '修改时间';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."SRC_USER" IS 'source user';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."SRC_IP" IS 'source ip';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."TENANT_ID" IS '租户字段';

COMMENT
ON COLUMN "NACOS_2_4_0_1"."CONFIG_INFO"."ENCRYPTED_DATA_KEY" IS '密钥';



INSERT INTO "NACOS_2_4_0_1"."USERS"("USERNAME", "PASSWORD", "ENABLED")
VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', 1);

INSERT INTO "NACOS_2_4_0_1"."ROLES"("USERNAME", "ROLE")
VALUES ('nacos', 'ROLE_ADMIN');

9. 修改 application.properties  

#
# Copyright 1999-2018 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.
#

#*************** Spring Boot Related Configurations ***************#
### Default web context path:
server.servlet.contextPath=/nacos
### Include message field
server.error.include-message=ALWAYS
### Default web server port:
server.port=8848

#*************** Network Related Configurations ***************#
### If prefer hostname over ip for Nacos server addresses in cluster.conf:
# nacos.inetutils.prefer-hostname-over-ip=false

### Specify local server's IP:
# nacos.inetutils.ip-address=

#*************** Config Module Related Configurations ***************#
### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
#spring.datasource.platform=mysql
spring.datasource.platform=dm
# nacos.plugin.datasource.log.enabled=true
#spring.sql.init.platform=mysql
spring.sql.init.platform=dm
### Count of DB:
db.num=1
db.jdbcDriverName=dm.jdbc.driver.DmDriver
### 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.url.0=jdbc:dm://127.0.0.1:5236/NACOS_2_4_0_1?STU&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
db.user.0=NACOS_2_4_0_1
db.password.0=xxxx
### the maximum retry times for push
nacos.config.push.maxRetryTime=50

#*************** Naming Module Related Configurations ***************#
### Data dispatch task execution period in milliseconds:

### 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

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


#*************** CMDB Module Related Configurations ***************#
### The interval to dump external CMDB in seconds:
# nacos.cmdb.dumpTaskInterval=3600

### The interval of polling data change event in seconds:
# nacos.cmdb.eventTaskInterval=10

### The interval of loading labels in seconds:
# nacos.cmdb.labelTaskInterval=300

### If turn on data loading task:
# nacos.cmdb.loadDataAtStart=false


#*************** Metrics Related Configurations ***************#
### Metrics for prometheus
#management.endpoints.web.exposure.include=*

### Metrics for elastic search
management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200

### Metrics for influx
management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true

#*************** Access Log Related Configurations ***************#
### If turn on the access log:
server.tomcat.accesslog.enabled=true

### accesslog automatic cleaning time
server.tomcat.accesslog.max-days=30

### The access log pattern:
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i

### The directory of access log:
server.tomcat.basedir=file:.


#*************** Access Control Related Configurations ***************#
### 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:
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

### 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

### Since 1.4.1, Turn on/off white auth for user-agent: nacos-server, only for upgrade from old version.
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=

### 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=SecretKey012345678901234567890123456789012345678901234567890123456789
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
#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:
nacos.istio.mcp.server.enabled=false



###*************** Add from 1.3.0 ***************###


#*************** Core Related Configurations ***************#

### set the WorkerID manually
# nacos.core.snowflake.worker-id=

### Member-MetaData
# nacos.core.member.meta.site=
# nacos.core.member.meta.adweight=
# nacos.core.member.meta.weight=

### MemberLookup
### Addressing pattern category, If set, the priority is highest
# nacos.core.member.lookup.type=[file,address-server]
## Set the cluster list with a configuration file or command-line argument
# nacos.member.list=192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809
## for AddressServerMemberLookup
# Maximum number of retries to query the address server upon initialization
# nacos.core.address-server.retry=5
## Server domain name address of [address-server] mode
# address.server.domain=jmenv.tbsite.net
## Server port of [address-server] mode
# address.server.port=8080
## Request address of [address-server] mode
# address.server.url=/nacos/serverlist

#*************** JRaft Related Configurations ***************#

### Sets the Raft cluster election timeout, default value is 5 second
# nacos.core.protocol.raft.data.election_timeout_ms=5000
### Sets the amount of time the Raft snapshot will execute periodically, default is 30 minute
# nacos.core.protocol.raft.data.snapshot_interval_secs=30
### raft internal worker threads
# nacos.core.protocol.raft.data.core_thread_num=8
### Number of threads required for raft business request processing
# nacos.core.protocol.raft.data.cli_service_thread_num=4
### raft linear read strategy. Safe linear reads are used by default, that is, the Leader tenure is confirmed by heartbeat
# nacos.core.protocol.raft.data.read_index_type=ReadOnlySafe
### rpc request timeout, default 5 seconds
# nacos.core.protocol.raft.data.rpc_request_timeout_ms=5000
### enable to support prometheus service discovery
#nacos.prometheus.metrics.enabled=true

10. 重新启动Nacos,测试达梦数据源

启动成功后,访问http://localhost:8848/nacos

在命名空间菜单>新建命名空间

看达梦数据库里已经有数据

三、release DM数据源版本

mvn -Prelease-nacos '-Dmaven.test.skip=true' '-Dcheckstyle.skip=true' -DskipTests '-Dpmd.skip=true' '-Drat.skip=true' clean install -U

1. 生产release包 

完成后,会distribution目录下生成target目录

 

 解压后

修改conf文件夹下的 application.properties 文件

修改内容和之前的一样

2. 启动nacos,测试成功

双击startup.cmd,默认是cluster模式,会失败

cmd运行,startup.cmd -m=standalone

启动成功

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值