nacos安装

本次教程是针对的nacos版本:2.0.1,不同的版本,可能略有不同。
官网下载地址:https://github.com/alibaba/nacos/tags

一、linux安装nacos

在这里插入图片描述

1. 解压压缩包

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

2.创建mysql数据库

SQL文件在解压文件下的config文件夹下,nacos-mysql.sql

nacos的各种数据存储在mysql数据库中

在MySQL服务器上创建nacos-mysql数据库,将SQL文件导入其中
在这里插入图片描述
在这里插入图片描述

3.编辑配置文件application.properties

编辑端口号:

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

解开数据库的注释

### 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

完整配置如下,已删掉多余的注释

 
 
#*************** 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    # mysql用户名root
db.password.0=nacos   # mysql密码123456
 
### 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
 
 
 
 


若是配置集群的话,需要修改cluster.conf.example

在里边添加其他节点的nacos的IP+端口号

在这里插入图片描述

4.进入bin目录启动nacos

集群启动模式

 ./startup.sh

单机启动模式

sh startup.sh -m standalone

http://192.168.8.15:5555/nacos 查看结果

默认的账号密码都是 nacos

二、windows安装nacos

在这里插入图片描述

下载完直接解压

在这里插入图片描述
这里的bin目录里面有windows启动文件startup.cmd,cmd进去命令窗
在这里插入图片描述
输入startup.cmd -m standalone

启动后会有一个cmd窗口去打印命令并启动。这里我们启动成功了,启动失败后窗口会一闪而过。

在这里插入图片描述

http://localhost:8848/nacos
默认的账号密码都是 nacos

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LC超人在良家

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值