nacos installation tutorial

content

nacos installation steps

1. Unzip the installation package

2. Create a mysql database

3. Edit the configuration file application.properties

Edit the port number:

Uncomment the database

Edit the address of the database connection

Add database connection pool configuration

The complete configuration is as follows, redundant comments have been deleted

4. Enter the bin directory to start nacos

Successful installation


nacos installation steps

This tutorial is for the nacos version: 2.0.1, different versions may be slightly different.

Official website download address:

https://github.com/alibaba/nacos/tags

I downloaded version 2.0.1

1. Unzip the installation package

tar -xvf nacos-server-2.0.1.tar.gz

2. Create a mysql database

The SQL file is in the config folder under the decompressed file, nacos-mysql.sql

Various data of nacos are stored in mysql database

Create a nacos-mysql database on the MySQL server and import the SQL file into it

3. Edit the configuration file application.properties

Edit the port number:

### Default web context path:
server.servlet.contextPath=/nacos
### Default web server port:
server.port=5555

Uncomment the database

### If use MySQL as datasource:
spring.datasource.platform=mysql

### Count of DB:
db.num=1

Edit the address of the database connection

### Connect URL of DB:
db.url.0=jdbc:mysql://mysql.xxx.tech:3306/nacos_prod?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=nacos
db.password.0=nacos

Add database connection pool configuration

### Connection pool configuration: hikariCP
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2

The complete configuration is as follows, redundant comments have been deleted



#*************** Spring Boot Related Configurations ***************#
### Default web context path:
server.servlet.contextPath=/nacos
### Default web server port:
server.port=5555



#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
spring.datasource.platform=mysql

### Count of DB:
db.num=1

### Connect URL of DB:
db.url.0=jdbc:mysql://mysql.xxx.tech:3306/nacos_prod?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=nacos
db.password.0=nacos

### Connection pool configuration: hikariCP
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2


# nacos.naming.expireInstance=true

nacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000




### Metrics for elastic search
management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200

### Metrics for influx
management.metrics.export.influx.enabled=false



#*************** Access Log Related Configurations ***************#
### If turn on the access log:
server.tomcat.accesslog.enabled=false

### The access log pattern:
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i

### The directory of access log:
server.tomcat.basedir=


#*************** Access Control Related Configurations ***************#


### The ignore urls of auth, is deprecated in 1.2.0:
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**

### The auth system to use, currently only 'nacos' is supported:
nacos.core.auth.system.type=nacos

### If turn on auth system:
nacos.core.auth.enabled=false

### The token expiration in seconds:
nacos.core.auth.default.token.expire.seconds=18000

### The default token:
nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789

### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
nacos.core.auth.caching.enabled=true

### Since 1.4.1, Turn on/off white auth for user-agent: nacos-server, only for upgrade from old version.
nacos.core.auth.enable.userAgentAuthWhite=true

### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
### The two properties is the white list for auth and used by identity the request from other server.
nacos.core.auth.server.identity.key=
nacos.core.auth.server.identity.value=

#*************** Istio Related Configurations ***************#
### If turn on the MCP server:
nacos.istio.mcp.server.enabled=false




If you configure a cluster, you need to modify cluster.conf.example

Add the IP+port number of nacos of other nodes inside

4. Enter the bin directory to start nacos

 ./startup.sh

Successful installation

SpringCloud project integration nacos please see this article

The SpringBoot project integrates nacos, and starts the error Failed to configure a DataSource: 'url' attribute is not speci_Xiao Xiaozhang Free—>Zhang Youbo-CSDN Blog_springboot integrates nacos to start the error This article introduces nacos, the commonly used term of nacos. The springboot project integrates the whole process of nacos and solves the startup error from multiple perspectives. Failed to configure a DataSource: 'url' attribute is not speci https://blog.csdn.net/promsing/article/details/121123765

If this blog is helpful to you, please remember to leave a message + like + favorite . 

Guess you like

Origin blog.csdn.net/promsing/article/details/123350094