当前位置:网站首页>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 )
边栏推荐
- 08- [istio] istio gateway, virtual service and the relationship between them
- Hackathon ifm
- 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
- 数据治理:主数据的3特征、4超越和3二八原则
- 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
- 图像融合--挑战、机遇与对策
- Get the path of edge browser
- Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
- opencv学习笔记九--背景建模+光流估计
- Data governance: 3 characteristics, 4 transcendence and 3 28 principles of master data
猜你喜欢
Codeforces Global Round 19(A~D)
22. Empty the table
Sanzi chess (C language)
Esrally domestic installation and use pit avoidance Guide - the latest in the whole network
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
File upload of DVWA range
Asia Pacific Financial Media | art cube of "designer universe": Guangzhou community designers achieve "great improvement" in urban quality | observation of stable strategy industry fund
【Redis】NoSQL数据库和redis简介
Mex related learning
将 NFT 设置为 ENS 个人资料头像的分步指南
随机推荐
What are the ways to download network pictures with PHP
PHP - Common magic method (nanny level teaching)
Epoll and IO multiplexing of redis
edge浏览器 路径获得
Oracle time display adjustment
23. Update data
flask返回文件下载
opencv学习笔记八--答题卡识别
Onie supports pice hard disk
Common functions for PHP to process strings
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
(lightoj - 1410) consistent verbs (thinking)
08- [istio] istio gateway, virtual service and the relationship between them
Description of octomap averagenodecolor function
[非线性控制理论]9_非线性控制理论串讲
49. Sound card driven article collection
Webrtc series-h.264 estimated bit rate calculation
Google may return to the Chinese market after the Spring Festival.
[Yugong series] February 2022 U3D full stack class 011 unity section 1 mind map
Linked list interview questions (Graphic explanation)