当前位置:网站首页>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 )
边栏推荐
- Notes on software development
- Entity class design for calculating age based on birthday
- Inspiration from the recruitment of bioinformatics analysts in the Department of laboratory medicine, Zhujiang Hospital, Southern Medical University
- Epoll and IO multiplexing of redis
- CAD ARX 获取当前的视口设置
- The Vice Minister of the Ministry of industry and information technology of "APEC industry +" of the national economic and information technology center led a team to Sichuan to investigate the operat
- National economic information center "APEC industry +": economic data released at the night of the Spring Festival | observation of stable strategy industry fund
- Iterator Foundation
- P3047 [USACO12FEB]Nearby Cows G(树形dp)
- Solution: intelligent site intelligent inspection scheme video monitoring system
猜你喜欢

Linked list interview questions (Graphic explanation)

Nft智能合约发行,盲盒,公开发售技术实战--拼图篇

Apache middleware vulnerability recurrence

Golang DNS 随便写写
![08- [istio] istio gateway, virtual service and the relationship between them](/img/fb/09793f5fd12c2906b73cc42722165f.jpg)
08- [istio] istio gateway, virtual service and the relationship between them

Secure captcha (unsafe verification code) of DVWA range

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

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
![[redis] Introduction to NoSQL database and redis](/img/95/229d7a08e94245f2733b8c59201cff.png)
[redis] Introduction to NoSQL database and redis

【Redis】NoSQL数据库和redis简介
随机推荐
【T31ZL智能视频应用处理器资料】
1202 character lookup
[redis] Introduction to NoSQL database and redis
shu mei pai
MySQL view tablespace and create table statements
Basics of reptile - Scratch reptile
MFC 给列表控件发送左键单击、双击、以及右键单击消息
Inspiration from the recruitment of bioinformatics analysts in the Department of laboratory medicine, Zhujiang Hospital, Southern Medical University
1015 reversible primes (20 points) prime d-ary
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
The difference between TS Gymnastics (cross operation) and interface inheritance
[cf gym101196-i] waif until dark network maximum flow
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
edge浏览器 路径获得
opencv学习笔记八--答题卡识别
Compliance and efficiency, accelerate the digital transformation of pharmaceutical enterprises, and create a new document resource center for pharmaceutical enterprises
Launch APS system to break the problem of decoupling material procurement plan from production practice
Secure captcha (unsafe verification code) of DVWA range
Understanding of law of large numbers and central limit theorem
数字经济时代,如何保障安全?