preface

To learn Nacos, build a set of Nacos source code locally for source tracing.

The build process

Download the source code

Github.com/alibaba/nac…

Download the Zip file and decompress it locally. Be careful not to put it in the Chinese directory.

To compile

Nacos is a Spring Boot + Maven project. We import it into Idea and compile it directly using Maven plug-in.

Setting startup Parameters

We currently only use a single node. Add startup environment parameters to Idea.

– dnacos. standalone=true: Indicates that a single node is started.

-dnacos. home=C:\nacos: Specifies the local directory of the nacos file. The default path is the user’s local path. If your Windows login name is Chinese, this path also contains Chinese, which will cause the nacOS project to fail to start.

Start the project

When you’re ready, start up.

The default user name and password are nacos.

The registration service

With the startup complete, let’s register a service manually.

Then look at the list:

This indicates that our service registration has been successful.

Nacos project relationship sorting

Nacos project

Nacos is a service discovery, dynamic configuration management application.

The Nacos project is an independent project that has nothing to do with Spring Cloud or Spring Cloud Alibaba.

Nacos Server: indicates the service side of Nacos.

Nacos Client: A Client of Nacos that encapsulates the request API for Nacos Server.

spring-cloud-starter-alibaba-nacos-discovery

To better integrate Nacos with Spring Cloud, Spring Cloud Alibaba provides a layer of adaptation, which IS what I normally call a quick start package.

When we start our project, we load the package through Spring Boot’s automatic configuration, then register the service and so on.

spring-cloud-starter-alibaba-nacos-config

Similar to the above, it is just a wrapper around Nacos dynamic configuration management capabilities.