当前位置:网站首页>Basic use of Nacos (1) - getting started
Basic use of Nacos (1) - getting started
2022-07-27 19:10:00 【Xiao Li, who loves traveling】
Nacos Basic use of
List of articles
One 、 Basic concepts
(1)Nacos:
Nacos It's a new open source project launched by Alibaba , It is a dynamic service discovery that is easier to build cloud native applications 、 Configuration management and service management platform .Nacos
Dedicated to helping you discover 、 Configure and manage microservices .Nacos
Provides an easy-to-use feature set , Helps you quickly implement dynamic service discovery 、 Service configuration 、 Service metadata and traffic management .Nacos
Helps you build more quickly and easily 、 Deliver and manage microservice platforms . Nacos Is to build in “ service ” Modern application architecture centered ( For example, the microservices paradigm 、 Cloud native paradigm )
Service infrastructure .
(2) Common registries :
Eureka( Native ,2.0 Performance bottlenecks , Stop maintenance )
Zookeeper( Support , Professional independent products . for example :dubbo)
Consul( Native ,GO Language development )
Nacos
be relative to Spring Cloud Eureka Come on ,Nacos More powerful .Nacos = Spring Cloud Eureka + Spring Cloud Config
Nacos It can be done with Spring, Spring Boot, Spring Cloud Integrate , And can replace Spring Cloud Eureka, Spring Cloud Config
- adopt Nacos Server and spring-cloud-starter-alibaba-nacos-discovery Implement service registration and discovery .
(3)Nacos function
Nacos Service oriented middleware ,Nacos Support all mainstream service discovery 、 Configure and manage .
Nacos It mainly provides the following four functions :
Service discovery and service health monitoring
Dynamic configuration services
dynamic DNS service
Services and metadata management
(4)Nacos chart 
You can put Nacos Understood as an intermediary , Connect consumers consumer And producers provider
Two 、Nacos Download and install
1 Download address
github Address : https://github.com/alibaba/nacos/releases
2 start-up Nacos service
- Linux/Unix/Mac
Start command (standalone Stands for stand-alone mode operation , Non cluster mode )
Start command :sh startup.sh -m standalone
- Windows
Start command :cmd startup.cmd perhaps double-click startup.cmd Run the file .
visit :http://localhost:8848/nacos
User name, password :nacos/nacos

3、 ... and 、 Registration service
First step : Introduce related dependencies into the module
stay pom.xml Add service registration related dependencies
<!-- Service registration -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
The second step : Configure in the configuration file of the module to be registered
stay application.properties/yml Add nacos Service address
# Nacos Service address
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
The third step : add to Nacos annotation
Add @EnableDiscoveryClient annotation
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
@SuppressWarnings("all")
@SpringBootApplication
@ComponentScan(basePackages = "com.atguigu")// Scanning package
@EnableDiscoveryClient // nacos register
public class EduApplication {
public static void main(String[] args) {
SpringApplication.run(EduApplication.class,args);
}
}
Step four : Restart project
The log output is as follows :
Launched the 3 A project , The registration center is shown in the figure 
边栏推荐
- npm的身份证和依赖
- asp. Net experience
- MySQL 04 advanced query (II)
- C # interaction with MySQL database - MySQL configuration and addition, deletion, query and modification operations
- Resource for NS2 beginner
- Unity学习笔记(刚体-物理-碰撞器-触发器)
- There is a problem with the time zone when the idea connects to the database. The server returns invalid timezone is red Need to set ‘serverTimezone‘ property.
- Unity学习笔记(实现传送带)
- v-if,v-else,v-for
- Sentinel1.8.4 persistent Nacos configuration
猜你喜欢

Performance analysis of continuous time system (1) - performance index and first and second order analysis of control system

MySQL 03 advanced query (I)

Unity learning notes (realize the conveyor belt)

v-if,v-else,v-for

Typescript installation

Unity shows Kinect captured shots

Express get/post/delete... Request

CMD 命令

IDEA成功连接Database但不显示表怎么办

自控原理学习笔记-系统稳定性分析(2)-环路分析及Nyquist-Bode判据
随机推荐
Using MATLAB to generate graphics for journals and conferences - plot
Word 2007+ tips
Latex使用--subfigure竖排图形
Useful resources for ns2
CMD command
WSN journal indexed by SCI
Unity shows Kinect captured shots
Unity显示Kinect捕获的镜头
Some advice for NS2 beginner.
How can I get started quickly when I change my career to soft testing and job hopping to a new company?
web UI 自动化测试:Selenium 语法详解 史上最全
Study notes of Microcomputer Principles - general integer instructions and Applications
The great idea of NS2
MySQL 04 advanced query (II)
Code interview of Amazon
微机原理学习笔记-通用整数指令及应用
There is a problem with the time zone when the idea connects to the database. The server returns invalid timezone is red Need to set ‘serverTimezone‘ property.
Unity learning notes (realize the conveyor belt)
An experience
Double insurance for line breaking