当前位置:网站首页>Nacos Development Manual
Nacos Development Manual
2022-07-06 07:59:00 【Frog at the bottom of the well】
1.Nacos brief introduction
Nacos Provides an easy-to-use feature set , Realize dynamic service discovery 、 Service configuration 、 Service metadata and traffic management . To replace the previously used registry (zookeeper , eureka wait ), And the configuration center (spring cloud config wait ).
- Reference documents :https://nacos.io/zh-cn/docs/what-is-nacos.html
2.Nacos Key features
Service discovery and service health monitoring
Service registration :
Spring Cloud Nacos Discovery follow Spring Cloud General standards , And implemented three interfaces :AutoServiceRegistration,ServiceRegistry and Registration. stay Spring Cloud The startup phase of the application , Will monitor WebServerInitializedEvent event . Initializing Web Received after container WebServerInitializedEvent When an event is , The registration operation will be triggered , And call ServiceRegistry register Method to register the service to Nacos Server.
Service discovery :
NacosServerList Realization com.netflix.loadbalancer.ServerList Interface , And automatically inject it into @ConditionOnMissingBean Next . The ribbon defaults to integration . More customizable if needed , You can use @Autowired Inject NacosRegistration Bean, And directly through its own NamingService The contents of the field call Nacos API.
Dynamic configuration services
Services and metadata management
- Reference documents :https://nacos.io/zh-cn/docs/use-nacos-with-springcloud.html(Nacos SpringCloud)
3.Nacos Cluster deployment description
stay nacos Unzip directory nacos/ Of conf Under the table of contents , There are configuration files cluster.conf, Please configure each line to ip:port.
Reference documents :https://nacos.io/zh-cn/docs/cluster-mode-quick-start.html
4.Nacos To configure
- Reference documents : Add link description
https://github.com/alibaba/spring-cloud-alibaba/issues/141
4.1 Custom namespace
Namespace : Used for tenant granularity configuration isolation . Under different namespaces , There can be the same Group or Data ID Configuration of .Namespace One of the most common scenarios is the separation of configurations between different environments , For example, develop the resources of test environment and production environment ( Such as configuration 、 service ) Isolation etc. .
4.2 Customize Group To configure
4.3 Custom extended data id To configure
4.4 Configure the refresh
Configure refresh usage @RefreshScope annotation . Code example :
The results :
After updating the configuration , Call again and return the result :
5. Service startup
Start the loaded configuration file
among :blade.ymal Configure the server in the configuration file 、spring To configure 、feign To configure 、hystrix To configure 、ribbon Configuration and other public configuration
blade-dev.yaml This is done in the configuration file redis、 Database connection and other configurations ( You can also add )
边栏推荐
- Solution: système de surveillance vidéo intelligent de patrouille sur le chantier
- 让学指针变得更简单(三)
- P3047 [USACO12FEB]Nearby Cows G(树形dp)
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- Learn Arduino with examples
- CAD ARX 获取当前的视口设置
- JS select all and tab bar switching, simple comments
- http缓存,强制缓存,协商缓存
- Mex related learning
- Luogu p4127 [ahoi2009] similar distribution problem solution
猜你喜欢
C语言 - 位段
The State Economic Information Center "APEC industry +" Western Silicon Valley will invest 2trillion yuan in Chengdu Chongqing economic circle, which will surpass the observation of Shanghai | stable
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
Document 2 Feb 12 16:54
wincc7.5下载安装教程(Win10系统)
数字经济时代,如何保障安全?
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
A Closer Look at How Fine-tuning Changes BERT
Opencv learning notes 9 -- background modeling + optical flow estimation
随机推荐
Step by step guide to setting NFT as an ens profile Avatar
C语言 - 位段
It's hard to find a job when the industry is in recession
[1. Delphi foundation] 1 Introduction to Delphi Programming
[Yugong series] creation of 009 unity object of U3D full stack class in February 2022
解决方案:智慧工地智能巡检方案视频监控系统
Asia Pacific Financial Media | "APEC industry +" Western Silicon Valley invests 2trillion yuan in Chengdu Chongqing economic circle to catch up with Shanghai | stable strategy industry fund observatio
[Yugong series] February 2022 U3D full stack class 010 prefabricated parts
A Closer Look at How Fine-tuning Changes BERT
实现精细化生产, MES、APS、ERP必不可少
软件开发的一点随记
Sanzi chess (C language)
Luogu p4127 [ahoi2009] similar distribution problem solution
你想知道的ArrayList知识都在这
Transformer principle and code elaboration
Golang DNS write casually
CAD ARX gets the current viewport settings
上线APS系统,破除物料采购计划与生产实际脱钩的难题
Onie supports pice hard disk
shu mei pai