当前位置:网站首页>Nacos installation and service registration
Nacos installation and service registration
2022-07-06 09:08:00 【look-word】
Nacos Installation of and registration of services
We all know naocs It's a registry , So what is the Registration Center ?
- What is a registry ?
- It is similar to an intermediary role ( Free conscience intermediary ), Play the role of a link in microservices , It provides the mapping relationship between service and service address , The producer registers the service name and address here ,
consumeraccording toThe service nameGet a responseAccess address.
- It is similar to an intermediary role ( Free conscience intermediary ), Play the role of a link in microservices , It provides the mapping relationship between service and service address , The producer registers the service name and address here ,
- Why use the registry
- When there is no registry , The caller needs to know when invoking the service
domain nameandport, When modified by the caller , You need to change the code , When there are many services called , Then we need to modify a lot of code , It is undoubtedly increasing our workload .
- When there is no registry , The caller needs to know when invoking the service
So how does he work on earth ?
working principle :
- producer ( Service providers ) Register your domain name and port with the registry
- Consumers pull the service list from the Registration Center , And make a remote call
- The registration center and service providers ensure that services can be provided normally by regularly checking the heartbeat

Nacos Prepare before use
Download after decompression We need to get into bin Directory start nacos service
Do not double-click to startnaocs It will be java Written stay target Under the table of contents You can see jar file

start-up :
In the search bar above Input cmd Enter the black window
command :startup.cmd -m standalone

When the bottom appears Program start time Just explain
Successful launch了

We came to the browser Input localhost:8848 You can see naocs The running interface We will carry out a series of configurations in it
- The username and password are both
naocs

All the services we register will appear in
List of servicesin , Services can be offline and other operations !

Service registration
nacos There are three steps in the registration process
- Add dependency
- To configure nacos
- Start the service
Add dependency
<!-- Service registration -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
To configure nacos
# Spring
spring:
application:
# apply name
name: project-xxxx
cloud:
nacos:
discovery:
# Service registration address ip Add slogan
server-addr: 127.0.0.1:8848
Start the service
You can see , The service just started has appeared in the service list

边栏推荐
猜你喜欢
随机推荐
[Hacker News Weekly] data visualization artifact; Top 10 Web hacker technologies; Postman supports grpc
Using C language to complete a simple calculator (function pointer array and callback function)
[oc]- < getting started with UI> -- common controls - prompt dialog box and wait for the prompt (circle)
CUDA实现focal_loss
甘肃旅游产品预订增四倍:“绿马”走红,甘肃博物馆周边民宿一房难求
Intel Distiller工具包-量化实现2
[embedded] print log using JLINK RTT
[OC]-<UI入门>--常用控件-UIButton
Simple use of promise in uniapp
After reading the programmer's story, I can't help covering my chest...
vb. Net changes with the window, scales the size of the control and maintains its relative position
LeetCode41——First Missing Positive——hashing in place & swap
LeetCode:387. The first unique character in the string
What is an R-value reference and what is the difference between it and an l-value?
LeetCode:26. 删除有序数组中的重复项
使用标签模板解决用户恶意输入的问题
CUDA implementation of self defined convolution attention operator
Intel distiller Toolkit - Quantitative implementation 1
[OC-Foundation框架]--<Copy对象复制>
[OC-Foundation框架]---【集合数组】








![[OC-Foundation框架]---【集合数组】](/img/b5/5e49ab9d026c60816f90f0c47b2ad8.png)
