当前位置:网站首页>Nacos registry
Nacos registry
2022-06-26 00:59:00 【Free dream programmer】
Nacos Registry Center

springcloud Of alibab Version of the registry 
nacso Official website
nacos.io


port 8848, Copy console Web access for nacos page
The default account password is nacos
Quick start

Go to the parent project and add dependencies
<!--nacos Management dependency of -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.2.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
stay user-service Add... To the module nacos rely on , Comment out eureka rely on ( Just add client dependencies )
<!--nacos Client dependent packages -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
Modify the configuration environment 
order-service Do the same thing
Back to nacos page , Refresh , Click Service Management 

Service hierarchical storage model



I copied a few user-service modular , Easy to understand cluster 
modify user-service Environment configuration of the module 

And then run 8083 and 8081 Port of user-service modular ( Stop all running modules first )
In the revision user-service Environment configuration of the module 
function 8082 Port of user-service modular ( If the number of clusters shows three , Just restart nacos)
Click on the details 

NacosRule Load balancing
hold order-service The module is configured as described above ( Cluster changed to HZ)
Call at this time order-service modular , After several more calls, you will find that all clusters have calls 
modify order-service Environment configuration of the module 
userserive: # The name of the micro service to be configured
ribbon:
NFLoadBalancerRuleClassName: com.alibaba.cloud.nacos.ribbon.NacosRule # Load balancing principle
Now you can go to the local cluster 
Weight configuration of service instances


Higher weight , The more frequent the service requests 
Environmental isolation







Nacos and Eureka contrast


stay order-service Modify the configuration environment 
restart order-service modular 

Nacos Configuration Management
I forgot to take a screenshot before creating the configuration , That is, there is no configuration 




Pull the micro service configuration
It was like this before 
Now? 

Go to user-service Add client management dependencies 
stay resources Create a new configuration file under the package bootstarp.yml
spring:
application:
name: userservice
profiles:
active: dev # Environmental Science
cloud:
nacos:
server-addr: nacos:8848 # nacos Address
config:
file-extension: yaml # File suffix


Configure the refresh

Change the configuration environment format , Directly refresh the open page 



Multi environment configuration sharing





边栏推荐
猜你喜欢

How to design the product roadmap?

1-11solutions to common problems of VMware virtual machine

Nacos注册中心

Flink报错:Error: A JNI error has occurred, please check your installation and try again

1-9network configuration in VMWare

Redisson 3.17.4 发布

flink报错:No ExecutorFactory found to execute the application

Redis的安装及启动

"Method not allowed", 405 problem analysis and solution

Msp430f5529lp official board (red) can not debug the problem
随机推荐
MySQL custom function instance
Reentrant functions must be used within signal processing functions
Compiler Telegram Desktop end (tdesktop) en utilisant vs2022
How to design the product roadmap?
JS reverse case: cracking login password
Making 3D romantic cool photo album [source code attached]
Kylin
Why is it best to use equals for integer comparisons
DPVS fullnat mode kept
Openresty chapter 01 introduction and installation configuration
Data synchronization
[system architecture] - what are MDA architecture, ADL and DSSA
Installation and startup of redis
Penetration tool -burpsuite
Modelsim simulation FFT core cannot be simulated solution (qsys)
Web學習之TypeScript
Unknown device ID does not appear on the STM32 st-link utility connection! Causes and Solutions
认识map
Casually painted
Ad20 (Altium designer) PCB highlight network