当前位置:网站首页>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 ,
consumer
according toThe service name
Get 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 name
andport
, 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 start
naocs 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 services
in , 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
边栏推荐
猜你喜欢
Pytest之收集用例规则与运行指定用例
一篇文章带你了解-selenium工作原理详解
LeetCode:498. 对角线遍历
Selenium+pytest automated test framework practice
MYSQL卸载方法与安装方法
[OC-Foundation框架]--<Copy对象复制>
An article takes you to understand the working principle of selenium in detail
【文本生成】论文合集推荐丨 斯坦福研究者引入时间控制方法 长文本生成更流畅
SAP ui5 date type sap ui. model. type. Analysis of the parsing format of date
Advance Computer Network Review(1)——FatTree
随机推荐
[oc]- < getting started with UI> -- common controls - prompt dialog box and wait for the prompt (circle)
MYSQL卸载方法与安装方法
Ijcai2022 collection of papers (continuously updated)
Esp8266-rtos IOT development
[text generation] recommended in the collection of papers - Stanford researchers introduce time control methods to make long text generation more smooth
Simclr: comparative learning in NLP
LeetCode:124. Maximum path sum in binary tree
ant-design的走马灯(Carousel)组件在TS(typescript)环境中调用prev以及next方法
opencv+dlib实现给蒙娜丽莎“配”眼镜
LeetCode:221. Largest Square
TP-LINK enterprise router PPTP configuration
[OC foundation framework] - [set array]
【图的三大存储方式】只会用邻接矩阵就out了
LeetCode:214. 最短回文串
Unsupported operation exception
【剑指offer】序列化二叉树
In depth analysis and encapsulation call of requests
[OC]-<UI入门>--常用控件的学习
What is MySQL? What is the learning path of MySQL
LeetCode:673. Number of longest increasing subsequences