Introduction to Nacos installation and configuration

Introduction

  • What is a registration center

The registration center plays a very important role in the microservice project. It is the link in the microservice architecture, similar to the address book , which records the mapping relationship between services and service addresses. In the distributed architecture, the service will be registered here, and when the service needs to call other services, it will find the address of the service here and call it.

  • Why use a registry

Registries solve the problem of service discovery. When there is no registration center, inter-service calls need to know the address of the called party or the proxy address. When the service changes the deployment address, it is necessary to modify the address specified in the call or modify the proxy configuration. With the registration center, each service only needs to know the service name when calling others, and the address will be synchronized through the registration center.

  • Nacos Registration Center

NacosIt is a dynamic service discovery, configuration management and service management platform open sourced by Alibaba that makes it easier to build cloud-native applications.

  • Comparison of the advantages of Nacos

    Common registration centers include Eureka consul zookeeper and why choose Nacos to see the picture below.

 It cannot be seen that Nacos, as a service discovery center, has more functional support.

1. Download address

Nacos download:  https://download.csdn.net/download/weixin_50002038/87717664  This version is 2.2.0

2. Configure Nacos

1. Nacos is a cluster mode cluster by default, which can be set in the startup.cmd property in the bin directoryMODE改为单机模式standalone。

set MODE="standalone"

2. It also needs to be configured in the config file, application.properties to connect to the database.

 After opening with the compiler, release these lines (corresponding to /database/username/password)

Execute this sql

 

 Copy the sql inside and execute it through the command line. I use Navicat (create these tables so that the configuration added in Nacos can be stored in our database)

After execution, the generated table structure is as follows

3. Start startup.cmd in the bin directory

 The startup is successful as follows:

 to stand-alone mode

 Nacos provides a visual operation platform, browser access ( http://localhost:8848/nacos/index.html ) can also be accessed by ip

 The login username and password are both nacos by default

Guess you like

Origin blog.csdn.net/weixin_50002038/article/details/130314083