Welcome to the world of Nacos!
Nacos /nɑ:kəʊs/ is the acronym for Dynamic Naming and Configuration Service, a dynamic service discovery, configuration management and service management platform that is easier to build cloud-native applications.Nacos is dedicated to helping you discover, configure and manage microservices. Nacos
provides a set of easy-to-use feature sets to help you quickly realize dynamic service discovery, service configuration, service metadata, and traffic management.Nacos helps you build, deliver and manage microservice platforms more agilely and easily. Nacos is a service infrastructure for building a "service"-centric modern application architecture
(such as microservice paradigm, cloud native paradigm).
Quote:
https://nacos.io/zh-cn/docs/what-is-nacos.html
Article Directory
-
- ⌚️nacos installation
- ⏰nacos management page introduction
- ⏳Persist nacos to mysql
- ⌛️nacos cluster construction
-
- ⌛️The first step is to prepare the prerequisites for the cluster
- ⌛️The second step, copy the cluster.conf.example file under conf as cluster.conf
- ⌛️The third step, if you used a stand-alone startup before, you need to change the mode of the start.sh file back, if not, ignore it
- ⌛️The fourth step, use nginx to proxy three servers
⌚️nacos installation
⌚️The first step. Download the installation package
Download the nacos-server-$version.zip package from the latest stable version .
If you can't open it, you can download it from here
Personal warehouse (writing as of the latest version)
⌚️The second step. Modify nacos configuration
⌚️2.1 Modificationapplication.properties
After version 2.2.0.1, the community release version will remove the following values in the document as the default values, which need to be filled in by yourself, otherwise the node cannot be started.
### The default token(Base64 String):
nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
### 2.1.0 版本后
nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
⌚️2.2 modificationstartup.cmd
set MODE="cluster"
change into
set MODE="standalone"
Standalone startup, otherwise cluster startup
Startup command (standalone represents stand-alone mode operation, non-cluster mode):
⌚️Step 3. Start nacos
After decompression, enter the bin path and run startup.cmd
If this page appears, the operation is successful
⌚️Step 4. View the console page
http://localhost:8848/nacos
The default username and password arenacos
Now that nacos has been successfully installed and started on your computer, let me introduce the nacos console page
⏰nacos management page introduction
⏰Namespace (namespace)
Similar to spring profiles, it isolates development, testing, and production environments
⏰Cluster management
The place to manage and view nacos cluster nodes
⏰Privilege management
You can modify the password of the account and create a new user (not very useful)
⏰Service Management
As an important module of the registration center, nacos can manage all services
⏰Configuration management
nacos is the place where config manages all configuration files in a unified manner
Each configuration file is separated by a namespace
Can manage historical configuration file versions
The above configurations are persisted in the data directory of the nacos folder. If you need to build a nacos cluster or persist data in mysql, you can refer to the following configuration
⏳Persist nacos to mysql
mysql-schema
⏳The first step is to execute the sql file under the conf folder
⏳The second step, modify application.properties
the file
as follows
Then start nacos
You can see that the data has been persisted in mysql
If you want to build a nacos cluster, you can refer to the following configuration
⌛️nacos cluster construction
⌛️The first step is to prepare the prerequisites for the cluster
Prepare three servers, or one server with three different ports, but their ports should be spaced apart and cannot be continuous, otherwise an error will be reported
Error creating bean with name ‘grpcSdkServer‘
Because the gRPC communication method was added after nacos2.0, two ports need to be added. The new ports are automatically generated with a certain offset on the basis of the configuration winner port (server.port). It will be offset by 1000, 1001 displacement. For example, 8848 needs to use two ports 9848 and 9849, so you can configure their ports as8848,8838,8828
Then follow the above method to let them connect to the same database to realize cluster data sharing, such as configuration files
⌛️The second step, copy the cluster.conf.example file under conf as cluster.conf
Write the following data
The steps of the three servers are the same, and the content of the cluster.conf file is also the same
⌛️The third step, if you used a stand-alone startup before, you need to change the mode of the start.sh file back, if not, ignore it
⌛️The fourth step, use nginx to proxy three servers
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream nacos-cluster {
server 192.168.0.116:8848;
server 192.168.0.115:8848;
server 192.168.0.117:8848;
}
server {
listen 81;
server_name localhost;
location /nacos {
proxy_pass http://nacos-cluster;
}
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Then access localhost:81/nacos
the address to access the nacos cluster
Nacos official website address: https://nacos.io/zh-cn/docs/quick-start.html