Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install the Nacos environment

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to install the Nacos environment". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

What is Nacos?

Nacos is used for service registration discovery and service configuration management. Nacos provides an easy-to-use Web Console. It can help developers quickly realize the requirements of service discovery, service configuration management, service metadata and so on. It is similar to Dubbo's zookeeper registry, SpringCloud's Eureka, and so on. At the same time, it also supports the characteristics of distributed service configuration management.

Key features of Nacos

Service registration discovery and health check

Dynamic configuration management, visual management interface

Dynamic DNS

Services and metadata management

Nacos map

Nacos ecological map

Nacos Infrastructure and concept

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

Service registry (Service Registry) Service registry, which is a database of services, their instances, and metadata. The service instance is registered with the service registry at startup and logged out when it is closed. The client of the service and the router queries the service registry to find the available instances of the service. 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) Service metadata refers to data that describes services, including service endpoints (endpoints), service tags, service version numbers, service instance weights, routing rules, security policies, etc.

A service provider (Service Provider) is an application that provides reusable and callable services

A service consumer (Service Consumer) is an application that initiates a call to a service

Configuration usually separates some parameters and variables that need to be changed from the code and manages them independently in the process of system development, and exists in the form of independent configuration files. The goal is to better adapt static system artifacts or deliverables (such as WAR,JAR packages, etc.) to the actual physical operating environment. Configuration management is generally included in the process of system deployment, which is completed by the system administrator or operation and maintenance personnel. Configuration change is one of the effective means to adjust the behavior of the system at run time.

Configuration management (Configuration Management) in the data center, all configuration-related activities in the system, such as editing, storage, distribution, change management, historical version management, change audit and so on, are collectively referred to as configuration management.

Name service (Naming Service) provides mapping management services between the "names" of all objects (Object) and entities (Entity) in distributed systems to associated metadata, such as ServiceName-> Endpoints Info, Distributed Lock Name-> Lock Owner/Status Info, DNS Domain Name-> IP List. Service discovery and DNS are the two major scenarios of name service.

Configuration Service (Configuration Service) A service provider that provides dynamic configuration or metadata and configuration management during the operation of a service or application.

Install Nacos1. Prepare for the environment

Nacos runs on the Java environment, and if you use source code to compile and run Nacos, you need to prepare the Apache Maven environment first.

64 bit OS, which supports Linux/Unix/Mac/Windows. Linux/Unix/Mac is recommended.

64 bit JDK1.8+

Maven 3.2 +

two。 Download the source code or installation package

You can choose to use the source code or directly use the installation package to obtain the Nacos

How to download source code from Github

Git clone https://github.com/alibaba/nacos.git

Cd nacos/

Mvn-Prelease-nacos-Dmaven.test.skip=true clean install-U

Ls-al distribution/target/

/ / change the $version to your actual path

Cd distribution/target/nacos-server-$version/nacos/bin

Download the compiled zip package

Unzip nacos-server-$version.zip or tar-xvf nacos-server-$version.tar.gz

Cd nacos/bin

3. Configure the MySql server

Nacos can persist data in two ways: 1.JDK 's Derby DB in-memory database 2. Use MySql database. Since DerbyDB is not very friendly to the presentation of data, we chose the MySql database.

Initialize the MySql database.

After downloading and decompressing Nacos, you can find the nacos-mysql.sql file in the / conf directory to initialize the MySql database.

Modify Nacos connection configuration

Select / conf/application.properties profile.

Find If user MySQL as datasource and modify the following configuration information

Spring.datasource.platform=mysql

# Count of DB:

Db.num=1

# Connect URL of DB:

Db.url.0=jdbc:mysql://localhost:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true

Db.user=XXX

Db.password=XXXXXXX

4. Start the server

Linux/Unix/Mac

Start command (Standalone stands for stand-alone mode, non-cluster mode):

Sh startup.sh-m standalone

If you are using a ubuntu system, or if you run the footer with an error [[symbol not found, try the following

Bash startup.sh-m standalone

Windows

Start the command:

Cmd startup.cmd

5. Web Console

The default port for Nacos is 8848

6. Service Registration Discovery Management

Service registration

Service discovery

Publish configuration

Get configuration

7. Shut down the server

Linux/Unix/Mac

Sh shutdown.sh

Windows

Cmd shutdown.cmd

Or double-click shutdown.cmd to run the file.

This is the end of "how to install the Nacos Environment". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report