当前位置:网站首页>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
边栏推荐
- 几道高频的JVM面试题
- Record: the solution of MySQL denial of access when CMD starts for the first time
- Redis介绍与使用
- TYUT太原理工大学2022数据库大题之概念模型设计
- 雇佣收银员【差分约束】
- [算法] 剑指offer2 golang 面试题10:和为k的子数组
- 3月15号 Go 1.18 正式版发布 了解最新特色以及使用方法
- Tyut Taiyuan University of technology 2022 introduction to software engineering examination question outline
- Fgui project packaging and Publishing & importing unity & the way to display the UI
- How to reduce the shutdown time of InnoDB database?
猜你喜欢
[算法] 剑指offer2 golang 面试题12:左右两边子数组的和相等
系统设计学习(一)Design Pastebin.com (or Bit.ly)
[algorithm] sword finger offer2 golang interview question 13: sum of numbers of two-dimensional submatrix
服务未正常关闭导致端口被占用
2-year experience summary, tell you how to do a good job in project management
[GNSS data processing] Helmert variance component estimation analysis and code implementation
Code example of MATLAB reading GNSS observation value o file
Experience summary of autumn recruitment of state-owned enterprises
MySQL 三万字精华总结 + 面试100 问,吊打面试官绰绰有余(收藏系列
[算法] 剑指offer2 golang 面试题5:单词长度的最大乘积
随机推荐
Inheritance and polymorphism (Part 2)
TYUT太原理工大学2022软工导论考试题型大纲
系统设计学习(三)Design Amazon‘s sales rank by category feature
RTKLIB: demo5 b34f. 1 vs b33
[dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity
阿里云一面:并发场景下的底层细节 - 伪共享问题
【干货】提升RTK模糊度固定率的建议之周跳探测
MySQL 三万字精华总结 + 面试100 问,吊打面试官绰绰有余(收藏系列
[algorithm] sword finger offer2 golang interview question 10: subarray with sum K
Sharing ideas of on-chip transplantation based on rtklib source code
【无标题】
Novatel board oem617d configuration step record
十分鐘徹底掌握緩存擊穿、緩存穿透、緩存雪崩
121 distributed interview questions and answers
Realization of the code for calculating the mean square error of GPS Height Fitting
初识C语言(上)
2-year experience summary, tell you how to do a good job in project management
Redis介绍与使用
wsl常用命令
[算法] 剑指offer2 golang 面试题10:和为k的子数组