Skip to content

Windows启动单机版Nacos

Setp1:下载Nacos

官方地址

Setp2:解压文件 并且修改配置

image-20250813171114716

这是解压后的目录,找到bin/startup.cmd使用编辑器打开

image-20250813171220678

修改配置为:

sh
set MODE="standalone"

Step3:启动Nacos

双击startup.cmd启动

启动程序会提示您输入3个鉴权相关配置(Nacos从3.0.0版本开始默认启用控制台鉴权功能,因此如下3个鉴权相关配置必须填写)如下所示:

`nacos.core.auth.plugin.nacos.token.secret.key` is missing, please set with Base64 string: ${your_input_token_secret_key}
nacos.core.auth.plugin.nacos.token.secret.key` Updated:
----------------------------------
`nacos.core.auth.server.identity.key` is missing, please set: ${your_input_server_identity_key}
`nacos.core.auth.server.identity.key` Updated:
----------------------------------
`nacos.core.auth.server.identity.value` is missing, please set: ${your_input_server_identity_key}
`nacos.core.auth.server.identity.value` Updated:
----------------------------------

输入后会启动Nacos

image-20250813171606078

启动成功!可以访问http://127.0.0.1:8080/可以进入web控制台

错误笔记:

the length of secret key must great than or equal 32 bytes; And the secret key must be encoded by base64.

错误原因

Nacos 在启用鉴权(Authentication)功能时,需要一个用于生成和验证 Token 的 密钥(secret key),该密钥必须满足以下两个条件:

  1. 长度 ≥ 32 字节(bytes)
  2. 必须是 Base64 编码格式

解决方案:

打开目录conf下面找到application.properties文件

image-20250820163005316

打开后找到:nacos.core.auth.plugin.nacos.token.secret.key 把这个属性取消注释(如果没有的话需要生成一个Base64 编码密钥然后复制填入)

image-20250820163103851

然后再重新运行nacos即可

最近更新