当前位置:网站首页>[microservices | Nacos] Nacos implements the advanced version of distributed configuration center
[microservices | Nacos] Nacos implements the advanced version of distributed configuration center
2022-06-22 03:04:00 【Bulst】
List of articles
Spring Cloud Alibaba Nacos Config Can support custom Data Id Configuration of .
Turn off the configuration completely
By setting spring.cloud.nacos.config.enabled = false To shut it down completely Spring Cloud Nacos Config
priority
Through the test, multiple Data Id When configuring at the same time , His priority relationship is spring.cloud.nacos.config.ext-config[n].data-id among n The greater the value of , The higher the priority .
Shared configuration
# Shared files
shared-configs[0]:
dataId: shared.yaml
# Automatically refresh , Not on by default
refresh: true
shared-configs[1]:
dataId: shared1.yaml
refresh: true
Extended configuration
# Extension files
extension-configs[0]:
dataId: extension.yaml
refresh: true
extension-configs[1]:
dataId: extension1.yaml
refresh: true
Automatically refresh
If it is written in the program @Value annotation , May adopt @RefreshScope Implement refresh , Just add the annotation to the specified class
Configure load priority in different ways :
Nacos The configuration center currently provides the following three configuration capabilities from Nacos Pull the relevant configuration , When the three methods are used together , One of their priorities is :A < B < C:
A: adopt spring.cloud.nacos.config.shared-configs[n].data-id Support multiple shares Data Id Configuration of
B: adopt spring.cloud.nacos.config.extension-configs[n].data-id The way to support multiple extensions Data Id Configuration of
C: Through internal rules (spring.cloud.nacos.config.prefix、spring.cloud.nacos.config.file-extension、spring.cloud.nacos.config.group) Automatically generate related Data Id To configure
bootstrap.yml
spring:
profiles:
active: dev
application:
name: ossa-service-producer
cloud:
nacos:
# docker start-up nacos:
# docker run --name mynacos -itd -e MODE=standalone -p 8848:8848 -p 9848:9848 -p 9849:9849 nacos/nacos-server:v2.0.3
discovery:
server-addr: 1.117.66.67
# namespace: d5042bab-be48-4946-9465-fb6e15ab75b7
# group: OSSA_GROUP
config:
# The default is service name + Environment name + . + yaml
server-addr: 1.117.66.67
file-extension: yaml
refresh-enabled: true
# group: OSSA_GROUP
# namespace: d5042bab-be48-4946-9465-fb6e15ab75b7
# Shared files
shared-configs[0]:
dataId: shared.yaml
# Automatically refresh , Not on by default
refresh: true
shared-configs[1]:
dataId: shared1.yaml
refresh: true
# Extension files
extension-configs[0]:
dataId: extension.yaml
refresh: true
extension-configs[1]:
dataId: extension1.yaml
refresh: true
边栏推荐
- Classification of traffic signs
- Figure data platform solution: cluster deployment
- BOM 属性、方法、事件应用案例
- Force buckle 461 Hamming distance
- 银联支付 返回商户 Nignx post请求405
- June25,2022 PMP Exam clearance manual-3
- Sword finger offer 56 Delete duplicate nodes of the linked list
- Comprehensive interpretation by enterprise reviewers: enterprise growth of [State Grid] China Power Finance Co., Ltd
- 【3.整数与浮点数二分】
- [percona toolkit] series of Pt table checksum and Pt table sync data verification and repair artifacts
猜你喜欢

【3.整数与浮点数二分】

JVM makes wheels

The latest official product of domestic brand oppo! This ppt report! It really refreshes my understanding of it

Must the database primary key be self incremented? What scenarios do not suggest self augmentation?

【Percona-Toolkit】系列之pt-table-checksum和pt-table-sync 数据校验修复神器

All the knowledge you want to know about the PMP Exam is here

Use of day19qpushbutton 2021-10-30

【5. 高精度减法】

自适应批作业调度器:为 Flink 批作业自动推导并行度

Redis6.0新特性(下)
随机推荐
【1. 快速排序】
libuv异步任务逻辑和uv_queue_work()
xpm_ memory_ A complete example of using the tdpram primitive
背光模组的基本结构与应用
Day14QProgressBar2021-10-17
Day13QMainWindow2021-09-28
C1-qt idea of realizing simple calculator 2021.10.15
Day12QFile2021-09-27
BOM 属性、方法、事件应用案例
Classification of traffic signs
【2. 归并排序】
图数据平台解决方案:集群部署
Architecture and practice of vivo container cluster monitoring system
An article thoroughly learns to draw data flow diagrams
File upload vulnerability shooting range analysis upload_ LABS
sequelize 常用命令使用
图数据库ONgDB Release v-1.0.2
Common string operations in day15qt 2021-10-20
Day21qt mouse event 2021-11-01
Sword finger offer 37 Serialized binary tree