Nacos 国产化数据库Kingbase适配
系统环境:java version “1.8.0_40”
开发环境
系统环境:java version “1.8.0_40”
Project Settings Project:11
Project Settings Modules:Language Level:8
Apache Maven 3.8.1
源码下载
Nacos 版本
nacos 2.2.0
版本说明:
Nacos 从 2.2.0 版本开始,可通过 SPI 机制注入多数据源实现插件,并在引入对应数据源实现后,便可在 Nacos 启动时通过读取 application.properties 配置文件中 spring.datasource.platform 配置项选择加载对应多数据源插件.
Nacos下载地址
git clone https://github.com/alibaba/nacos.git
Nacos编译运行
1.在cmd中进入nacos文件夹
cd C:\myWork\dev_workspace\Git-Repo\alibaba\nacos
2.执行BUILDING 中的脚本
mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U
3.编译后的文件位置
.....\Git-Repo\nacos\Nacos\distribution\target
4.启动
默认是集群模式,所以如果没有配置,直接运行会报错。
window情况下:
处理方式一: 进入cmd 输入startup.cmd -m standalone即可成功启动
startup.cmd -m standalone
处理方式二: 编辑startup.cmd启动命令,将set MODE="cluster"变成set MODE=“standalone” 然后双击即可编辑startup.cmd启动命令
单机模式通常用于测试,或者简单使用,集群模式主要用于生产环境保证高可用。
数据库初始化
在nacos-distribution项目的conf下有MySQL的数据库初始化语句,需要在数据库里执行
kingbase数据库初始化
数据库设置
特殊设置: kingbase.conf , ‘’ null 的转换,不然应用会出现错误。
在data/kingbase.conf文件中,默认为on
ora_input_emptystr_isnull = off
创建数据库
数据库名称:nacos_kingbase
字符集:utf-8/utf8_bin
nacos-kingbase.sql
CREATE TABLE "config_info" (
"id" bigint AUTO_INCREMENT,
"data_id" character varying(255 char) NOT NULL,
"group_id" character varying(255 char) NULL,
"content" text NOT NULL,
"md5" character varying(32 char) NULL,
"gmt_create" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"gmt_modified" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"src_user" text NULL,
"src_ip" character varying(50 char) NULL,
"app_name" character varying(128 char) NULL,
"tenant_id" character varying(128 char) NULL DEFAULT NULL::varchar,
"c_desc" character varying(256 char) NULL,
"c_use" character varying(64 char) NULL,
"effect" character varying(64 char) NULL,
"type" character varying(64 char) NULL,
"c_schema" text NULL,
"encrypted_data_key" text NULL,
CONSTRAINT "PRIMARY_73F26186" PRIMARY KEY (id)
);
-- "pig_config"."config_info_aggr" definition
-- Drop table
-- DROP TABLE "config_info_aggr";
CREATE TABLE "config_info_aggr" (
"id" bigint AUTO_INCREMENT,
"data_id" character varying(255 char) NOT NULL,
"group_id" character varying(255 char) NOT NULL,
"datum_id" character varying(255 char) NOT NULL,
"content" text NOT NULL,
"gmt_modified" timestamp(0) without time zone NOT NULL,
"app_name" character varying(128 char) NULL,
"tenant_id" character varying(128 char) NULL DEFAULT NULL::varchar,
CONSTRAINT "PRIMARY_F787E5C0" PRIMARY KEY (id)
);
-- "pig_config"."config_info_beta" definition
-- Drop table
-- DROP TABLE "config_info_beta";
CREATE TABLE "config_info_beta" (
"id" bigint AUTO_INCREMENT,
"data_id" character varying(255 char) NOT NULL,
"group_id" character varying(128 char) NOT NULL,
"app_name" character varying(128 char) NULL,
"content" text NOT NULL,
"beta_ips" character varying(1024 char) NULL,
"md5" character varying(32 char) NULL,
"gmt_create" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"gmt_modified" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"src_user" text NULL,
"src_ip" character varying(50 char) NULL,
"tenant_id" character varying(128 char) NULL DEFAULT NULL::varchar,
"encrypted_data_key" text NULL,
CONSTRAINT "PRIMARY_E3F5B61F" PRIMARY KEY (id)
);
-- "pig_config"."config_info_tag" definition
-- Drop table
-- DROP TABLE "config_info_tag";
CREATE TABLE "config_info_tag" (
"id" bigint AUTO_INCREMENT,
"data_id" character varying(255 char) NOT NULL,
"group_id" character varying(128 char) NOT NULL,
"tenant_id" character varying(128 char) NULL DEFAULT NULL::varchar,
"tag_id" character varying(128 char) NOT NULL,
"app_name" character varying(128 char) NULL,
"content" text NOT NULL,
"md5" character varying(32 char) NULL,
"gmt_create" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"gmt_modified" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"src_user" text NULL,
"src_ip" character varying(50 char) NULL,
CONSTRAINT "PRIMARY_26447CE1" PRIMARY KEY (id)
);
-- "pig_config"."config_tags_relation" definition
-- Drop table
-- DROP TABLE "config_tags_relation";
CREATE TABLE "config_tags_relation" (
"id" bigint NOT NULL,
"tag_name" character varying(128 char) NOT NULL,
"tag_type" character varying(64 char) NULL,
"data_id" character varying(255 char) NOT NULL,
"group_id" character varying(128 char) NOT NULL,
"tenant_id" character varying(128 char) NULL DEFAULT NULL::varchar,
"nid" bigint AUTO_INCREMENT,
CONSTRAINT "PRIMARY_82226084" PRIMARY KEY (nid)
);
CREATE INDEX idx_tenant_id_4FB846F8 ON config_tags_relation USING btree (tenant_id);
-- "pig_config"."group_capacity" definition
-- Drop table
-- DROP TABLE "group_capacity";
CREATE TABLE "group_capacity" (
"id" bigint AUTO_INCREMENT,
"group_id" character varying(128 char) NOT NULL DEFAULT NULL::varchar,
"quota" bigint NOT NULL DEFAULT 0,
"usage" bigint NOT NULL DEFAULT 0,
"max_size" bigint NOT NULL DEFAULT 0,
"max_aggr_count" bigint NOT NULL DEFAULT 0,
"max_aggr_size" bigint NOT NULL DEFAULT 0,
"max_history_count" bigint NOT NULL DEFAULT 0,
"gmt_create" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"gmt_modified" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "PRIMARY_D72B7E75" PRIMARY KEY (id)
);
-- "pig_config"."his_config_info" definition
-- Drop table
-- DROP TABLE "his_config_info";
CREATE TABLE "his_config_info" (
"id" numeric NOT NULL,
"nid" bigint AUTO_INCREMENT,
"data_id" character varying(255 char) NOT NULL,
"group_id" character varying(128 char) NOT NULL,
"app_name" character varying(128 char) NULL,
"content" text NOT NULL,
"md5" character varying(32 char) NULL,
"gmt_create" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"gmt_modified" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"src_user" text NULL,
"src_ip" character varying(50 char) NULL,
"op_type" character(10 char) NULL,
"tenant_id" character varying(128 char) NULL DEFAULT NULL::varchar,
"encrypted_data_key" text NULL,
CONSTRAINT "PRIMARY_93A4DC6B" PRIMARY KEY (nid)
);
CREATE INDEX idx_did_8DE97C10 ON his_config_info USING btree (data_id);
CREATE INDEX idx_gmt_create_F3B3E5A1 ON his_config_info USING btree (gmt_create);
CREATE INDEX idx_gmt_modified_42DBB1BB ON his_config_info USING btree (gmt_modified);
-- "pig_config"."permissions" definition
-- Drop table
-- DROP TABLE "permissions";
CREATE TABLE "permissions" (
"role" character varying(50 char) NOT NULL,
"resource" character varying(255 char) NOT NULL,
"action" character varying(8 char) NOT NULL
);
-- "pig_config"."roles" definition
-- Drop table
-- DROP TABLE "roles";
CREATE TABLE "roles" (
"username" character varying(50 char) NOT NULL,
"role" character varying(50 char) NOT NULL
);
-- "pig_config"."tenant_capacity" definition
-- Drop table
-- DROP TABLE "tenant_capacity";
CREATE TABLE "tenant_capacity" (
"id" bigint AUTO_INCREMENT,
"tenant_id" character varying(128 char) NOT NULL DEFAULT NULL::varchar,
"quota" bigint NOT NULL DEFAULT 0,
"usage" bigint NOT NULL DEFAULT 0,
"max_size" bigint NOT NULL DEFAULT 0,
"max_aggr_count" bigint NOT NULL DEFAULT 0,
"max_aggr_size" bigint NOT NULL DEFAULT 0,
"max_history_count" bigint NOT NULL DEFAULT 0,
"gmt_create" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"gmt_modified" timestamp(0) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "PRIMARY_F4CCC2AA" PRIMARY KEY (id)
);
-- "pig_config"."tenant_info" definition
-- Drop table
-- DROP TABLE "tenant_info";
CREATE TABLE "tenant_info" (
"id" bigint AUTO_INCREMENT,
"kp" character varying(128 char) NOT NULL,
"tenant_id" character varying(128 char) NULL DEFAULT NULL::varchar,
"tenant_name" character varying(128 char) NULL DEFAULT NULL::varchar,
"tenant_desc" character varying(256 char) NULL,
"create_source" character varying(32 char) NULL,
"gmt_create" bigint NOT NULL,
"gmt_modified" bigint NOT NULL,
CONSTRAINT "PRIMARY_8B91ED1E" PRIMARY KEY (id)
);
CREATE INDEX idx_tenant_id_ABB71DBA ON tenant_info USING btree (tenant_id);
-- "pig_config"."users" definition
-- Drop table
-- DROP TABLE "users";
CREATE TABLE "users" (
"username" character varying(50 char) NOT NULL,
"password" character varying(500 char) NOT NULL,
"enabled" tinyint NOT NULL,
CONSTRAINT "PRIMARY_1A6B23BE" PRIMARY KEY (username)
);
INSERT INTO "roles" ("username","role") VALUES
('nacos','ROLE_ADMIN');
INSERT INTO "users" ("username","password","enabled") VALUES
('nacos','$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu',1);
重新创建约束
删除表中的唯一约束, 重新创建。
重新创建约束
config_info:
alter table public.config_info add constraint uk_configinfo_datagrouptenant_C827FEB8 unique (data_id, group_id, tenant_id);
config_info_aggr:
alter table public.config_info_aggr add constraint uk_configinfoaggr_datagrouptenantdatum_D10078D8 unique (data_id, group_id, tenant_id, datum_id);
config_info_beta:
alter table public.config_info_beta add constraint uk_configinfobeta_datagrouptenant_E4D7C681 unique (data_id, group_id, tenant_id);
config_info_tag:
alter table public.config_info_tag add constraint uk_configinfotag_datagrouptenanttag_5CBEB0AC unique (data_id, group_id, tenant_id, tag_id);
config_tags_relation:
alter table public.config_tags_relation add constraint uk_configtagrelation_configidtag_25395725 unique (id, tag_name, tag_type);
group_capacity:
alter table public.group_capacity add constraint uk_group_id_377325F2 unique (group_id);
permissions:
alter table public.permissions add constraint uk_role_permission_9C323780 unique (role, resource, action);
roles:
alter table public.roles add constraint idx_user_role_314C5701 unique (username, role);
tenant_capacity:
alter table public.tenant_capacity add constraint uk_tenant_id_22935E1 unique (tenant_id);
tenant_info:
alter table public.tenant_info add constraint uk_tenant_info_kptenantid_195888C1 unique (kp, tenant_id);
源码修改
增加依赖
1.Maven项目引入Kingbase驱动KingbaseES V8 R6
1、驱动下载
Java数据库驱动JDBC人大金仓也提供了支持,在官网中可以找到下载地址,下载完成后就可以在对于的目录中找到需要的驱动jar包了
https://kingbase.oss-cn-beijing.aliyuncs.com/KES_INTERFACE/jdbc/x86/jdbc-x86.zip
2、引入Maven
1.上传到我们的Maven仓库中
使用Maven的命令进行安装,指定maven配置文件, 不然会上传到默认仓库中。
mvn install:install-file -Dfile=C:\Users\wenbo\Downloads\kingbase-jdbc-x86\kingbase8-8.6.0.jar --settings=C:\myWork\dev_env\maven-settings\settings.xml -DgroupId=com.kingbase8 -DartifactId=kingbase8 -Dversion=8.6.0 -Dpackaging=jar
执行后如图,就表示安装成功了
2.再将我们的Maven索引更新一下,以免出现无法识别的错误
3.POM文件依赖添加
依赖添加如下
<dependencies>
<dependency>
<groupId>com.kingbase8</groupId>
<artifactId>kingbase8</artifactId>
<version>8.6.0</version>
</dependency>
</dependencies>
2.添加Kingbase插件和nacos-datasource-plugin-kingbase插件
nacos-all pom.xml
<kingbase8.version>8.6.0</kingbase8.version>
<dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>nacos-datasource-plugin-kingbase</artifactId>
<version>0.0.2</version>
</dependency>
<!--人大金仓数据库驱动-->
<dependency>
<groupId>com.kingbase8</groupId>
<artifactId>kingbase8</artifactId>
<version>${kingbase8.version}</version>
</dependency>
nacos-config pom.xml
<dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>nacos-datasource-plugin-kingbase</artifactId>
<version>0.0.2</version>
</dependency>
<!--人大金仓数据库驱动-->
<dependency>
<groupId>com.kingbase8</groupId>
<artifactId>kingbase8</artifactId>
nacos-console pom.xml
<dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>nacos-datasource-plugin-kingbase</artifactId>
<version>0.0.2</version>
</dependency>
<!--人大金仓数据库驱动-->
<dependency>
<groupId>com.kingbase8</groupId>
<artifactId>kingbase8</artifactId>
</dependency>
nacos-datasource-plugin
<!--人大金仓数据库驱动-->
<dependency>
<groupId>com.kingbase8</groupId>
<artifactId>kingbase8</artifactId>
</dependency>
应用改造
1.(nacos-config)PropertiesConstant.java
Path Form Source Root
com/alibaba/nacos/config/server/constant/PropertiesConstant.java
增加:
public static final String KINGBASE = "kingbase8";
2.(nacos-config)PropertyUtil.java#loadSetting
Path Form Source Root
com/alibaba/nacos/config/server/utils/PropertyUtil.java
修改loadSetting方法
private void loadSetting() {
try {
setNotifyConnectTimeout(Integer.parseInt(EnvUtil.getProperty(PropertiesConstant.NOTIFY_CONNECT_TIMEOUT,
String.valueOf(notifyConnectTimeout))));
LOGGER.info("notifyConnectTimeout:{}", notifyConnectTimeout);
setNotifySocketTimeout(Integer.parseInt(EnvUtil.getProperty(PropertiesConstant.NOTIFY_SOCKET_TIMEOUT,
String.valueOf(notifySocketTimeout))));
LOGGER.info("notifySocketTimeout:{}", notifySocketTimeout);
setHealthCheck(Boolean.parseBoolean(
EnvUtil.getProperty(PropertiesConstant.IS_HEALTH_CHECK, String.valueOf(isHealthCheck))));
LOGGER.info("isHealthCheck:{}", isHealthCheck);
setMaxHealthCheckFailCount(Integer.parseInt(
EnvUtil.getProperty(PropertiesConstant.MAX_HEALTH_CHECK_FAIL_COUNT,
String.valueOf(maxHealthCheckFailCount))));
LOGGER.info("maxHealthCheckFailCount:{}", maxHealthCheckFailCount);
setMaxContent(
Integer.parseInt(EnvUtil.getProperty(PropertiesConstant.MAX_CONTENT, String.valueOf(maxContent))));
LOGGER.info("maxContent:{}", maxContent);
// capacity management
setManageCapacity(getBoolean(PropertiesConstant.IS_MANAGE_CAPACITY, isManageCapacity));
setCapacityLimitCheck(getBoolean(PropertiesConstant.IS_CAPACITY_LIMIT_CHECK, isCapacityLimitCheck));
setDefaultClusterQuota(getInt(PropertiesConstant.DEFAULT_CLUSTER_QUOTA, defaultClusterQuota));
setDefaultGroupQuota(getInt(PropertiesConstant.DEFAULT_GROUP_QUOTA, defaultGroupQuota));
setDefaultTenantQuota(getInt(PropertiesConstant.DEFAULT_TENANT_QUOTA, defaultTenantQuota));
setDefaultMaxSize(getInt(PropertiesConstant.DEFAULT_MAX_SIZE, defaultMaxSize));
setDefaultMaxAggrCount(getInt(PropertiesConstant.DEFAULT_MAX_AGGR_COUNT, defaultMaxAggrCount));
setDefaultMaxAggrSize(getInt(PropertiesConstant.DEFAULT_MAX_AGGR_SIZE, defaultMaxAggrSize));
setCorrectUsageDelay(getInt(PropertiesConstant.CORRECT_USAGE_DELAY, correctUsageDelay));
setInitialExpansionPercent(getInt(PropertiesConstant.INITIAL_EXPANSION_PERCENT, initialExpansionPercent));
// External data sources are used by default in cluster mode
//修改以下逻辑:获得当前的platform,如果platform为mysql或Kingbase8,则设置使用外部数据库为true。
String platform = DatasourcePlatformUtil.getDatasourcePlatform("");
boolean useExternalStorage = PropertiesConstant.MYSQL.equalsIgnoreCase(platform)
||
PropertiesConstant.KINGBASE.equalsIgnoreCase(platform);
setUseExternalDB(useExternalStorage);
//修改完成。
// must initialize after setUseExternalDB
// This value is true in stand-alone mode and false in cluster mode
// If this value is set to true in cluster mode, nacos's distributed storage engine is turned on
// default value is depend on ${nacos.standalone}
if (isUseExternalDB()) {
setEmbeddedStorage(false);
} else {
boolean embeddedStorage =
PropertyUtil.embeddedStorage || Boolean.getBoolean(PropertiesConstant.EMBEDDED_STORAGE);
setEmbeddedStorage(embeddedStorage);
// If the embedded data source storage is not turned on, it is automatically
// upgraded to the external data source storage, as before
if (!embeddedStorage) {
setUseExternalDB(true);
}
}
} catch (Exception e) {
LOGGER.error("read application.properties failed", e);
throw e;
}
}
3.(nacos-config)ExternalDataSourceProperties.java
Path Form Source Root
com/alibaba/nacos/config/server/service/datasource/ExternalDataSourceProperties.java
定义kingbase驱动常量
private static final String JDBC_DRIVER_NAME_KINGBASE = "com.kingbase8.Driver";
修改build方法
List<HikariDataSource> build(Environment environment, Callback<HikariDataSource> callback) {
//修改以下逻辑:获得当前配置的数据源DatasourcePlatform,如果为kingbase8,则设置使用kingbase驱动"com.kingbase8.Driver"。
String jdbcDriverName = JDBC_DRIVER_NAME_MYSQL;
String dataSourceType = DatasourcePlatformUtil.getDatasourcePlatform("");
// 获得配置的platform
if (PropertiesConstant.KINGBASE.equalsIgnoreCase(dataSourceType)) {
jdbcDriverName = JDBC_DRIVER_NAME_KINGBASE;
} else {
jdbcDriverName = JDBC_DRIVER_NAME_MYSQL;
}
//修改完成
System.out.println("[dwb] " + this.getClass().getName() + " [build] [ current jdbcDriverName] : " + jdbcDriverName);
List<HikariDataSource> dataSources = new ArrayList<>();
Binder.get(environment).bind("db", Bindable.ofInstance(this));
Preconditions.checkArgument(Objects.nonNull(num), "db.num is null");
Preconditions.checkArgument(CollectionUtils.isNotEmpty(user), "db.user or db.user.[index] is null");
Preconditions.checkArgument(CollectionUtils.isNotEmpty(password), "db.password or db.password.[index] is null");
for (int index = 0; index < num; index++) {
int currentSize = index + 1;
Preconditions.checkArgument(url.size() >= currentSize, "db.url.%s is null", index);
DataSourcePoolProperties poolProperties = DataSourcePoolProperties.build(environment);
if (StringUtils.isEmpty(poolProperties.getDataSource().getDriverClassName())) {
poolProperties.setDriverClassName(jdbcDriverName);
}
poolProperties.setJdbcUrl(url.get(index).trim());
poolProperties.setUsername(getOrDefault(user, index, user.get(0)).trim());
poolProperties.setPassword(getOrDefault(password, index, password.get(0)).trim());
HikariDataSource ds = poolProperties.getDataSource();
if (StringUtils.isEmpty(ds.getConnectionTestQuery())) {
ds.setConnectionTestQuery(TEST_QUERY);
}
dataSources.add(ds);
callback.accept(ds);
}
Preconditions.checkArgument(CollectionUtils.isNotEmpty(dataSources), "no datasource available");
return dataSources;
}
4.(config-console)StartingApplicationListener.java(增加log日志)
Path Form Source Root
com/alibaba/nacos/core/listener/StartingApplicationListener.java
方法增加log,方便启动时观察使用的platform
private void judgeStorageMode(ConfigurableEnvironment env) {
// External data sources are used by default in cluster mode
String platform = this.getDatasourcePlatform(env);
System.out.println("[dwb]" + this.getClass().getName() + "platform:" + platform);
boolean useExternalStorage =
!DEFAULT_DATASOURCE_PLATFORM.equalsIgnoreCase(platform) && !DERBY_DATABASE.equalsIgnoreCase(platform);
// must initialize after setUseExternalDB
// This value is true in stand-alone mode and false in cluster mode
// If this value is set to true in cluster mode, nacos's distributed storage engine is turned on
// default value is depend on ${nacos.standalone}
if (!useExternalStorage) {
boolean embeddedStorage = EnvUtil.getStandaloneMode() || Boolean.getBoolean("embeddedStorage");
// If the embedded data source storage is not turned on, it is automatically
// upgraded to the external data source storage, as before
if (!embeddedStorage) {
useExternalStorage = true;
}
}
LOGGER.info("Nacos started successfully in {} mode. use {} storage current platform {}",
System.getProperty(MODE_PROPERTY_KEY_STAND_MODE),
useExternalStorage ? DATASOURCE_MODE_EXTERNAL : DATASOURCE_MODE_EMBEDDED, platform
);
}
5.(nacos-config)DatasourcePlatformUtil(增加log日志)
Path Form Source Root
com/alibaba/nacos/config/server/utils/DatasourcePlatformUtil.java
增加log,方便启动时观察传入参数及获得的platform
public static String getDatasourcePlatform(String defaultPlatform) {
String platform = EnvUtil.getProperty(PropertiesConstant.DATASOURCE_PLATFORM_PROPERTY, defaultPlatform);
if (StringUtils.isBlank(platform)) {
platform = EnvUtil.getProperty(PropertiesConstant.DATASOURCE_PLATFORM_PROPERTY_OLD, defaultPlatform);
}
System.out.println("[dwb] " + DatasourcePlatformUtil.class.getName()
+
" [inputParam] : [" + defaultPlatform + "] [current platform] : " + platform);
return platform;
}
6.(nacos-console)application.properties
增加数据库连接配置
Path Form Source Root
application.properties
调整内容
#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
#MySQL
#spring.datasource.platform=mysql
#db.num=1
#db.url.0=jdbc:mysql://192.168.xx.xx:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
#db.user.0=root
#db.password.0=xxxx
#Kingbase
spring.datasource.platform=kingbase8
db.num=1
db.url.0=jdbc:kingbase8://192.168.xx.xx:xx/nacos_kingbase?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=xx
db.password.0=xx
7.(nacos-distribution)application.properties
Path Form Source Root
distribution/conf/application.properties
application.properties
#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
#MySQL
#spring.datasource.platform=mysql
#db.num=1
#db.url.0=jdbc:mysql://192.168.xx.xx:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
#db.user.0=root
#db.password.0=xx
#Kingbase
spring.datasource.platform=kingbase8
db.num=1
db.url.0=jdbc:kingbase8://192.168.xx.xx:54321/nacos_kingbase?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=xx
db.password.0=xx
常用命令
编译
mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U
启动
startup.cmd -m standalone
更多推荐
所有评论(0)