当前位置:网站首页>Alibaba cloud microservices (II) distributed service configuration center and Nacos usage scenarios and implementation introduction
Alibaba cloud microservices (II) distributed service configuration center and Nacos usage scenarios and implementation introduction
2022-07-06 13:09:00 【Geometer】
If the registry is used for addressing in microservices , Help one service call another service , The function of service configuration is to modify the configuration of each service more conveniently , for instance , If we use a configuration file to configure information , If you want to modify a configuration item , We need to repackage , Release , But if you use the configuration center , Then you only need to modify
About using the configuration center for Shenma , I think there are mainly the following reasons :
1. Separate multi-environment configuration
2. More flexible management permissions
3. Higher security
About 1. Separate multi-environment configuration
In the same case, different configuration environments may be required
as follows , We are in the configuration center nacos Add a configuration information 

Test in the service to see whether the configuration information can be read 
You can see from the figure below that the configuration information is read successfully 
The configuration information just now is in properties Configured in , If you change the configuration file to yaml What will be done ?

You can see the read yaml File information 
After that, you can start from Nacos Two configuration files were observed in time , It is more convenient to manage files 
For configuration information, it is common that the same code may be in different scenarios profile and namespace There are different configurations on
profile It's in different profile You can have the same configuration item but different values
As follows, in the environment profile Change to develop
Use the app name +profile To create 
About namespace Different
Create a new one namespace training

Record his namespace id
Add to configuration 
You can see the read namespace Configuration information of succeeded 
About Nacos
Nacos There are mainly service registration and discovery , Health check and access policy 
The picture below is nacos and zookeeper as well as Eureka Comparison of 
You can see Nacos You can freely choose a consistency agreement , How to choose a consistency protocol , It can be understood as
If the success or failure of a single write request is important , Should guarantee cp The consistency of , because cp The consistency of services sacrifices the overall availability of services in exchange for data consistency
If the success or failure of a single request is not very important , Instead, data consistency can be maintained through subsequent data compensation mechanisms , Should guarantee ap The consistency of
besides ,Nacos It also has its own advantages in access strategy
The access strategy of the server is more flexible , Because there is no need to modify the client and it can be adjusted more flexibly in the process of use 
In the data service model , Services and clusters can store different service configurations for service management , Like some specific information, such as ip And ports can be managed by the instance
Nacos The implementation of is mainly divided into the following modules 
Preliminary permission verification is defined in the user interface module , Parameter verification and data conversion
The push module manages all subscribers , And push trigger , Aggregation and weight removal
The health check module supports server-side detection and client-side reporting
Access policies filter the server through different access policies , Currently, the supported access policies are tag based access policies 
Store data and server Synchronization between to ensure data consistency
边栏推荐
- 最短Hamilton路径 (状压DP)
- Tyut Taiyuan University of technology 2022 introduction to software engineering examination question outline
- Application architecture of large live broadcast platform
- Tyut Taiyuan University of technology 2022 introduction to software engineering
- MYSQL索引钟B-TREE ,B+TREE ,HASH索引之间的区别和应用场景
- [algorithm] sword finger offer2 golang interview question 3: the number of 1 in the binary form of the first n numbers
- Role movement in the first person perspective
- Chromatic judgement bipartite graph
- 平衡二叉树详解 通俗易懂
- 编辑距离(多源BFS)
猜你喜欢

Dark chain lock (lca+ difference on tree)

Edit distance (multi-source BFS)

一文搞定 UDP 和 TCP 高频面试题!

抽象类和接口

系统设计学习(一)Design Pastebin.com (or Bit.ly)

编辑距离(多源BFS)

阿里云一面:并发场景下的底层细节 - 伪共享问题

Redis介绍与使用
![[dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity](/img/9d/7284c1399964d3fb48886f12e4941c.jpg)
[dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity

TYUT太原理工大学2022数据库大题之分解关系模式
随机推荐
【快趁你舍友打游戏,来看道题吧】
Role movement in the first person perspective
Sharing ideas of on-chip transplantation based on rtklib source code
Usage differences between isempty and isblank
4.30 dynamic memory allocation notes
[GNSS] robust estimation (robust estimation) principle and program implementation
One article to get UDP and TCP high-frequency interview questions!
Implementation of Excel import and export functions
MYSQL索引钟B-TREE ,B+TREE ,HASH索引之间的区别和应用场景
On March 15, the official version of go 1.18 was released to learn about the latest features and usage
[algorithm] sword finger offer2 golang interview question 10: subarray with sum K
几道高频的JVM面试题
TYUT太原理工大学2022数据库题库选择题总结
Answer to "software testing" exercise: Chapter 1
Ten minutes to thoroughly master cache breakdown, cache penetration, cache avalanche
Fairygui bar subfamily (scroll bar, slider, progress bar)
Chromatic judgement bipartite graph
[dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity
Error: symbol not found
WSL common commands