当前位置:网站首页>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 )
边栏推荐
- "Designer universe": "benefit dimension" APEC public welfare + 2022 the latest slogan and the new platform will be launched soon | Asia Pacific Financial Media
- 【Redis】NoSQL数据库和redis简介
- [redis] Introduction to NoSQL database and redis
- Description of octomap averagenodecolor function
- Le chemin du navigateur Edge obtient
- P3047 [USACO12FEB]Nearby Cows G(树形dp)
- Sanzi chess (C language)
- PHP - Common magic method (nanny level teaching)
- 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
- Flash return file download
猜你喜欢

"Designer universe" Guangdong responds to the opinions of the national development and Reform Commission. Primary school students incarnate as small community designers | national economic and Informa

Golang DNS 随便写写

2.10transfrom attribute

Asia Pacific Financial Media | designer universe | Guangdong responds to the opinions of the national development and Reform Commission. Primary school students incarnate as small community designers

ROS learning (IX): referencing custom message types in header files

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

将 NFT 设置为 ENS 个人资料头像的分步指南

Golang DNS write casually

Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center

22. Empty the table
随机推荐
08- [istio] istio gateway, virtual service and the relationship between them
DataX self check error /datax/plugin/reader/_ drdsreader/plugin. Json] does not exist
[KMP] template
Epoll and IO multiplexing of redis
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
[非线性控制理论]9_非线性控制理论串讲
Key value judgment in the cycle of TS type gymnastics, as keyword use
opencv学习笔记九--背景建模+光流估计
File upload of DVWA range
How to estimate the number of threads
esRally国内安装使用避坑指南-全网最新
Easy to use tcp-udp_ Debug tool download and use
珠海金山面试复盘
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
数据治理:微服务架构下的数据治理
WebRTC系列-H.264预估码率计算
Esrally domestic installation and use pit avoidance Guide - the latest in the whole network
Google may return to the Chinese market after the Spring Festival.
(lightoj - 1410) consistent verbs (thinking)
shu mei pai