An overview,

In the Netflix stage of Spring Cloud, we adopted Eureka as our service registration and discovery server, and now we use the Nacos component provided by Spring Cloud Alibaba to replace this scheme.

What is Nacos

Nacos is dedicated to helping you discover, configure, and manage microservices. Nacos provides an easy-to-use feature set that helps you quickly implement dynamic service discovery, service configuration, service metadata, and traffic management.

Nacos helps you build, deliver, and manage microservices platforms more agile and easily. Nacos is the service infrastructure for building modern “service” centric application architectures (e.g., microservices paradigm, cloud native paradigm).

Click: Spring Cloud Alibaba video tutorial, learn Spring whole family barrel course, comprehensive and in-depth study of Spring micro service architecture.

Iii. Basic structure and concept

Services (Service)

A service is a software function or set of software functions (such as the retrieval of specific information or the execution of a set of operations) that can be reused by different clients for different purposes (such as through cross-process network calls). Nacos support mainstream ecological Service, such as Kubernetes Service, gRPC | Dubbo RPC Service or Spring Cloud RESTful Service.

Service Registry

Service registry, which is a database of services, instances, and metadata. Service instances are registered with the service registry at startup and unregistered at shutdown. Clients of services and routers query the service registry to find available instances of services. The service registry may invoke the health check API of the service instance to verify that it can handle the request.

Service Metadata

Service metadata refers to data describing services, including endpoints, service labels, service version numbers, service instance weights, routing rules, and security policies

Service Provider

An application that provides reusable and callable services

Service Consumer

The application that initiates a call to a service

The Configuration (Configuration)

In the process of system development, some parameters and variables that need to be changed are usually separated from the code and managed independently, existing in the form of independent configuration files. The goal is to make static system artifacts or deliverables (such as wars, JARS, etc.) better match the actual physical operating environment. Configuration management is usually performed by system administrators or O&M personnel during system deployment. Configuration change is one of the effective means to adjust the behavior of the system at run time.

Configuration Management

In a data center, all configuration-related activities such as editing, storing, distributing, change management, historical version management, and change audit are collectively referred to as configuration management.

Naming Service

Provide the mapping management service between the “name” of all objects and entities in the distributed system and the associated metadata. For example, ServiceName -> Endpoints Info, Distributed Lock Name -> Lock Owner/Status Info, DNS Domain Name -> IP List, Service discovery and DNS are two scenarios of name services.

Configuration Service

A service provider that provides dynamic configuration or metadata and configuration management during service or application execution.

Four, download and install

Prepare the environment

Nacos relies on the Java environment to run. If you build and run Nacos from code and need to configure the Maven environment for this, make sure you install it in one of the following versions:

  • The 64-bit OS supports Linux, Unix, Mac, and Windows. Linux, Unix, and Mac are recommended.
  • 64 – bit JDK 1.8 +
  • Maven 3.2 x +

Download and Install

Git clone https://github.com/alibaba/nacos.git # # download the source code installation CD to a local warehouse nacos/MVN - Prelease - nacos clean install -uCopy the code

Note: Download dependency takes a long time, please be patient…

Start the service

CD distribution/target/nacos - server - 0.7.0 / nacos/bin #. Linux/startup. Sh - m # standalone Windows startup. CMDCopy the code

We’ll talk about service providers next time. Learn springCloud Alibaba in Java Microservices Architecture video tutorials.