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). The above excerpt is from the official website

Nacos download

You can download the latest zip package from GitGithub.com/alibaba/nac…, Windows version select zip installation package on the line, of course, you can also download the source code to compile, I am too lazy to do

Nacos version 1.4.3, which is the latest version as of this post.

The installation

Has the website haveInstall the tutorialAfter downloading, you will get a compressed package. Decompress it to the path you want to install. Find the bin directory, enter CMD in the address bar, and press Enter

Then enter the following command from the command line. Standalone stands for standalone mode, not cluster mode. The default is clustered mode, and currently only one NACOS server is started, so it is started as a single machine.

startup.cmd -m standalone
Copy the code

If the following page is displayed, the system succeeds:Once successful, type in the browser address bar: red or yeshttp://localhost:8848/nacos/index.html, you can see the following page, the default user name password is nacos, input after submission. Home page after successful login

Configuration File Introduction

There are several configuration files in the conf directory of the NACOS installation, each of which serves a different purpose:

  • Application. properties: default springBoot configuration file
  • Cluster.conf. example: example cluster file
  • Nacos-logback. XML: log configuration file
  • Nacos-mysql. SQL: run the script for mysql database
  • Schema. SQL: The Derby database runs scripts

Database Configuration

Prior to version 0.7, nacOS used an embedded database (Derby), which had limitations such as not supporting multi-user operations and connection backlogs due to large data volumes. Nacos provides support for MySQL. Nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql: nacos-mysql.sql Run 1.4.0-ipv6_support-update.sql. 1.4.0-ipv6_support-update. SQL IPv6 support was added after 1.4, only the field length was changed.After running, you can find our login user name in the Users table

Modifying a Configuration File

Go to the application. Properties file in the configuration file path and open it. Find the part in the red box and open the comment with #. You can see that the default port number of nacOS is 8848. After modification, you can restart, and the installation of NACOS on a single machine is complete.

Nacos cluster

Nacos cluster consists of the following steps:

  1. Modify the cluster.conf configuration file

Change the name of the configuration file cluster.conf.example in the conf folder to cluster.conf and then change the IP address of cluster.conf. Change the IP address to your own IP address. Do not use localhost or 127.0.0.1 for the following reasons:

  • The localhost cluster will not be found in the node list
  • With 127.0.0.1, nacOS by default adds nodes with local LAN IP addresses to the node list, which is equivalent to adding one more node.

The configuration is as follows:

192.168. 561.:8848
192.168. 561.:8849
192.168. 561.:8850
Copy the code
  1. Make multiple copies of the nacOS modified above, I made three copies here

Change the server.port property of application.properties in the respective conf folder to 8848, 8849, and 8850 respectively

  1. Start each node in the cluster

In the bin directory of the nacOS installation directory, find the startup. CMD batch commands and double-click them respectively to start them. If the following page is displayed, the startup is successful.Address for logging in to any serverhttp://localhost:8848/nacos/index.html#/login, the cluster management – > can see nacos of each node in the node list.

This is the end of the nacOS installation.

General ability, limited level, if any mistakes, please point out. Give it a thumbs up if it helps you