/** 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.*//******************************************//* 表名称 = config_info *//******************************************/CREATETABLE`config_info`(`id`bigint(20)NOTNULLAUTO_INCREMENTCOMMENT'id',`data_id`varchar(255)NOTNULLCOMMENT'data_id',`group_id`varchar(128)DEFAULTNULLCOMMENT'group_id',`content`longtextNOTNULLCOMMENT'content',`md5`varchar(32)DEFAULTNULLCOMMENT'md5',`gmt_create`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'创建时间',`gmt_modified`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'修改时间',`src_user`textCOMMENT'source user',`src_ip`varchar(50)DEFAULTNULLCOMMENT'source ip',`app_name`varchar(128)DEFAULTNULLCOMMENT'app_name',`tenant_id`varchar(128)DEFAULT''COMMENT'租户字段',`c_desc`varchar(256)DEFAULTNULLCOMMENT'configuration description',`c_use`varchar(64)DEFAULTNULLCOMMENT'configuration usage',`effect`varchar(64)DEFAULTNULLCOMMENT'配置生效的描述',`type`varchar(64)DEFAULTNULLCOMMENT'配置的类型',`c_schema`textCOMMENT'配置的模式',`encrypted_data_key`textNOTNULLCOMMENT'密钥',PRIMARYKEY(`id`),UNIQUEKEY`uk_configinfo_datagrouptenant`(`data_id`,`group_id`,`tenant_id`))ENGINE=InnoDBDEFAULTCHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';/******************************************//* 表名称 = config_info_aggr *//******************************************/CREATETABLE`config_info_aggr`(`id`bigint(20)NOTNULLAUTO_INCREMENTCOMMENT'id',`data_id`varchar(255)NOTNULLCOMMENT'data_id',`group_id`varchar(128)NOTNULLCOMMENT'group_id',`datum_id`varchar(255)NOTNULLCOMMENT'datum_id',`content`longtextNOTNULLCOMMENT'内容',`gmt_modified`datetimeNOTNULLCOMMENT'修改时间',`app_name`varchar(128)DEFAULTNULLCOMMENT'app_name',`tenant_id`varchar(128)DEFAULT''COMMENT'租户字段',PRIMARYKEY(`id`),UNIQUEKEY`uk_configinfoaggr_datagrouptenantdatum`(`data_id`,`group_id`,`tenant_id`,`datum_id`))ENGINE=InnoDBDEFAULTCHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';/******************************************//* 表名称 = config_info_beta *//******************************************/CREATETABLE`config_info_beta`(`id`bigint(20)NOTNULLAUTO_INCREMENTCOMMENT'id',`data_id`varchar(255)NOTNULLCOMMENT'data_id',`group_id`varchar(128)NOTNULLCOMMENT'group_id',`app_name`varchar(128)DEFAULTNULLCOMMENT'app_name',`content`longtextNOTNULLCOMMENT'content',`beta_ips`varchar(1024)DEFAULTNULLCOMMENT'betaIps',`md5`varchar(32)DEFAULTNULLCOMMENT'md5',`gmt_create`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'创建时间',`gmt_modified`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'修改时间',`src_user`textCOMMENT'source user',`src_ip`varchar(50)DEFAULTNULLCOMMENT'source ip',`tenant_id`varchar(128)DEFAULT''COMMENT'租户字段',`encrypted_data_key`textNOTNULLCOMMENT'密钥',PRIMARYKEY(`id`),UNIQUEKEY`uk_configinfobeta_datagrouptenant`(`data_id`,`group_id`,`tenant_id`))ENGINE=InnoDBDEFAULTCHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';/******************************************//* 表名称 = config_info_tag *//******************************************/CREATETABLE`config_info_tag`(`id`bigint(20)NOTNULLAUTO_INCREMENTCOMMENT'id',`data_id`varchar(255)NOTNULLCOMMENT'data_id',`group_id`varchar(128)NOTNULLCOMMENT'group_id',`tenant_id`varchar(128)DEFAULT''COMMENT'tenant_id',`tag_id`varchar(128)NOTNULLCOMMENT'tag_id',`app_name`varchar(128)DEFAULTNULLCOMMENT'app_name',`content`longtextNOTNULLCOMMENT'content',`md5`varchar(32)DEFAULTNULLCOMMENT'md5',`gmt_create`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'创建时间',`gmt_modified`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'修改时间',`src_user`textCOMMENT'source user',`src_ip`varchar(50)DEFAULTNULLCOMMENT'source ip',PRIMARYKEY(`id`),UNIQUEKEY`uk_configinfotag_datagrouptenanttag`(`data_id`,`group_id`,`tenant_id`,`tag_id`))ENGINE=InnoDBDEFAULTCHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';/******************************************//* 表名称 = config_tags_relation *//******************************************/CREATETABLE`config_tags_relation`(`id`bigint(20)NOTNULLCOMMENT'id',`tag_name`varchar(128)NOTNULLCOMMENT'tag_name',`tag_type`varchar(64)DEFAULTNULLCOMMENT'tag_type',`data_id`varchar(255)NOTNULLCOMMENT'data_id',`group_id`varchar(128)NOTNULLCOMMENT'group_id',`tenant_id`varchar(128)DEFAULT''COMMENT'tenant_id',`nid`bigint(20)NOTNULLAUTO_INCREMENTCOMMENT'nid, 自增长标识',PRIMARYKEY(`nid`),UNIQUEKEY`uk_configtagrelation_configidtag`(`id`,`tag_name`,`tag_type`),KEY`idx_tenant_id`(`tenant_id`))ENGINE=InnoDBDEFAULTCHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';/******************************************//* 表名称 = group_capacity *//******************************************/CREATETABLE`group_capacity`(`id`bigint(20)unsignedNOTNULLAUTO_INCREMENTCOMMENT'主键ID',`group_id`varchar(128)NOTNULLDEFAULT''COMMENT'Group ID,空字符表示整个集群',`quota`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'配额,0表示使用默认值',`usage`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'使用量',`max_size`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'单个配置大小上限,单位为字节,0表示使用默认值',`max_aggr_count`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'聚合子配置最大个数,,0表示使用默认值',`max_aggr_size`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',`max_history_count`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'最大变更历史数量',`gmt_create`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'创建时间',`gmt_modified`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'修改时间',PRIMARYKEY(`id`),UNIQUEKEY`uk_group_id`(`group_id`))ENGINE=InnoDBDEFAULTCHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';/******************************************//* 表名称 = his_config_info *//******************************************/CREATETABLE`his_config_info`(`id`bigint(20)unsignedNOTNULLCOMMENT'id',`nid`bigint(20)unsignedNOTNULLAUTO_INCREMENTCOMMENT'nid, 自增标识',`data_id`varchar(255)NOTNULLCOMMENT'data_id',`group_id`varchar(128)NOTNULLCOMMENT'group_id',`app_name`varchar(128)DEFAULTNULLCOMMENT'app_name',`content`longtextNOTNULLCOMMENT'content',`md5`varchar(32)DEFAULTNULLCOMMENT'md5',`gmt_create`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'创建时间',`gmt_modified`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'修改时间',`src_user`textCOMMENT'source user',`src_ip`varchar(50)DEFAULTNULLCOMMENT'source ip',`op_type`char(10)DEFAULTNULLCOMMENT'operation type',`tenant_id`varchar(128)DEFAULT''COMMENT'租户字段',`encrypted_data_key`textNOTNULLCOMMENT'密钥',PRIMARYKEY(`nid`),KEY`idx_gmt_create`(`gmt_create`),KEY`idx_gmt_modified`(`gmt_modified`),KEY`idx_did`(`data_id`))ENGINE=InnoDBDEFAULTCHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';/******************************************//* 表名称 = tenant_capacity *//******************************************/CREATETABLE`tenant_capacity`(`id`bigint(20)unsignedNOTNULLAUTO_INCREMENTCOMMENT'主键ID',`tenant_id`varchar(128)NOTNULLDEFAULT''COMMENT'Tenant ID',`quota`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'配额,0表示使用默认值',`usage`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'使用量',`max_size`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'单个配置大小上限,单位为字节,0表示使用默认值',`max_aggr_count`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'聚合子配置最大个数',`max_aggr_size`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',`max_history_count`int(10)unsignedNOTNULLDEFAULT'0'COMMENT'最大变更历史数量',`gmt_create`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'创建时间',`gmt_modified`datetimeNOTNULLDEFAULTCURRENT_TIMESTAMPCOMMENT'修改时间',PRIMARYKEY(`id`),UNIQUEKEY`uk_tenant_id`(`tenant_id`))ENGINE=InnoDBDEFAULTCHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';CREATETABLE`tenant_info`(`id`bigint(20)NOTNULLAUTO_INCREMENTCOMMENT'id',`kp`varchar(128)NOTNULLCOMMENT'kp',`tenant_id`varchar(128)default''COMMENT'tenant_id',`tenant_name`varchar(128)default''COMMENT'tenant_name',`tenant_desc`varchar(256)DEFAULTNULLCOMMENT'tenant_desc',`create_source`varchar(32)DEFAULTNULLCOMMENT'create_source',`gmt_create`bigint(20)NOTNULLCOMMENT'创建时间',`gmt_modified`bigint(20)NOTNULLCOMMENT'修改时间',PRIMARYKEY(`id`),UNIQUEKEY`uk_tenant_info_kptenantid`(`kp`,`tenant_id`),KEY`idx_tenant_id`(`tenant_id`))ENGINE=InnoDBDEFAULTCHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';CREATETABLE`users`(`username`varchar(50)NOTNULLPRIMARYKEYCOMMENT'username',`password`varchar(500)NOTNULLCOMMENT'password',`enabled`booleanNOTNULLCOMMENT'enabled');CREATETABLE`roles`(`username`varchar(50)NOTNULLCOMMENT'username',`role`varchar(50)NOTNULLCOMMENT'role',UNIQUEINDEX`idx_user_role`(`username`ASC,`role`ASC)USINGBTREE);CREATETABLE`permissions`(`role`varchar(50)NOTNULLCOMMENT'role',`resource`varchar(255)NOTNULLCOMMENT'resource',`action`varchar(8)NOTNULLCOMMENT'action',UNIQUEINDEX`uk_role_permission`(`role`,`resource`,`action`)USINGBTREE);INSERTINTO users (username, password, enabled)VALUES('nacos','$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu',TRUE);INSERTINTO roles (username, role)VALUES('nacos','ROLE_ADMIN');
cd /docker/nacos/conf/
dockercp nacos:home/nacos/conf/application.properties ./
修改配置文件
# springserver.servlet.contextPath=/nacos
server.contextPath=/nacos
server.port=8848
server.tomcat.accesslog.max-days=30server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
server.tomcat.accesslog.enabled=${TOMCAT_ACCESSLOG_ENABLED:false}
server.error.include-message=ALWAYS
# default current work dirserver.tomcat.basedir=file:.
#*************** Config Module Related Configurations ***************#### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.#spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:}spring.sql.init.platform=mysql
nacos.cmdb.dumpTaskInterval=3600nacos.cmdb.eventTaskInterval=10nacos.cmdb.labelTaskInterval=300nacos.cmdb.loadDataAtStart=false
db.num=1db.url.0=jdbc:mysql://192.168.56.10:3306/nacos-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false
db.user.0=root
db.password.0=123456## DB connection pool settingsdb.pool.config.connectionTimeout=30000db.pool.config.validationTimeout=10000db.pool.config.maximumPoolSize=20db.pool.config.minimumIdle=2### The auth system to use, currently only 'nacos' and 'ldap' is supported:nacos.core.auth.system.type=${NACOS_AUTH_SYSTEM_TYPE:nacos}### worked when nacos.core.auth.system.type=nacos### The token expiration in seconds:nacos.core.auth.plugin.nacos.token.expire.seconds=${NACOS_AUTH_TOKEN_EXPIRE_SECONDS:18000}### The default token:nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:}### 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=${NACOS_AUTH_CACHE_ENABLE:false}nacos.core.auth.enable.userAgentAuthWhite=${NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE:false}nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:}nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_VALUE:}## spring security config### turn off securitynacos.security.ignore.urls=${NACOS_SECURITY_IGNORE_URLS:/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**}# metrics for elastic searchmanagement.metrics.export.elastic.enabled=false
management.metrics.export.influx.enabled=false
nacos.naming.distro.taskDispatchThreadCount=10nacos.naming.distro.taskDispatchPeriod=200nacos.naming.distro.batchSyncKeyCount=1000nacos.naming.distro.initDataRatio=0.9nacos.naming.distro.syncRetryDelay=5000nacos.naming.data.warmup=true
nacos.console.ui.enabled=true
nacos.core.param.check.enabled=true