当前位置:网站首页>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
边栏推荐
- 初识指针笔记
- [算法] 劍指offer2 golang 面試題2:二進制加法
- Fundamentals of UD decomposition of KF UD decomposition [1]
- 异常:IOException:Stream Closed
- rtklib单点定位spp使用抗差估计遇到的问题及解决
- Abstract classes and interfaces
- Compile GDAL source code with nmake (win10, vs2022)
- TYUT太原理工大学2022数据库题库选择题总结
- [algorithm] sword finger offer2 golang interview question 6: sum of two numbers in the sorting array
- 图书管理系统小练习
猜你喜欢

Rt-ppp test using rtknavi

TYUT太原理工大学2022数据库大题之分解关系模式

基本Dos命令

【无标题】

On March 15, the official version of go 1.18 was released to learn about the latest features and usage

Redis介绍与使用

记录:初次cmd启动MySQL拒接访问之解决
![[algorithm] sword finger offer2 golang interview question 1: integer division](/img/e6/f17135207b3540ec58e5a9eed54220.png)
[algorithm] sword finger offer2 golang interview question 1: integer division
![[algorithm] sword finger offer2 golang interview question 8: the shortest subarray with a sum greater than or equal to K](/img/8c/1b6ba3b1830ad28176190170c98628.png)
[algorithm] sword finger offer2 golang interview question 8: the shortest subarray with a sum greater than or equal to K

rtklib单点定位spp使用抗差估计遇到的问题及解决
随机推荐
Novatel board oem617d configuration step record
基本Dos命令
平衡二叉树详解 通俗易懂
On March 15, the official version of go 1.18 was released to learn about the latest features and usage
IText 7 generate PDF summary
MySQL backup -- common errors in xtrabackup backup
Chromatic judgement bipartite graph
[Chongqing Guangdong education] Shandong University College Physics reference materials
Exception: ioexception:stream closed
染色法判定二分图
[GNSS] robust estimation (robust estimation) principle and program implementation
What are the advantages of using SQL in Excel VBA
Usage differences between isempty and isblank
167. Sum of two numbers II - input ordered array - Double pointers
One article to get UDP and TCP high-frequency interview questions!
Error: sorting and subscript out of bounds
Shortest Hamilton path (pressure DP)
[算法] 剑指offer2 golang 面试题6:排序数组中的两个数字之和
[algorithm] sword finger offer2 golang interview question 13: sum of numbers of two-dimensional submatrix
Employment of cashier [differential constraint]