The problem of cmd startup failure in the window environment under the latest version of Nacos

1. Download the latest nacos version from the official website: https://github.com/alibaba/nacos/releases

2. Download nacos-server-2.2.x.zip

3. After the download is complete, extract it to a folder

Note: The decompressed path cannot have any "Chinese" and "spaces"

4. What needs to be changed:

startup.cmd changes

1.nacos/bin/ 目录下的 startup.cmd
2.右键编辑,找到   set MODE="cluster"  替换成  set MODE="standalone"
3.cluster是集群启动模式,standalone是单机启动模式

Application.properties changes under the conf package

1.nacos.core.auth.enabled 设置为true,表示开启鉴权,默认为false
2.nacos.core.auth.server.identity.key=   设置一串字符串,类似于账号~
3.nacos.core.auth.server.identity.value=   设置一串字符串,类似于密码~
4.nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789      
此key是重点,在2.2.0之前位数少会自动补满,但是最新版本需要自行填充满

5. Configure the data source

First find mysql-schema.sql from the conf folder , execute SQL, create a library and table structure, then modify the configuration file application.properties and
add at the end:

spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&serverTimezone=UTC
db.user=root	
db.password=root

Then you can start it. If it still fails to start, you can look at the nacos.log file under the logs folder~

Address: http://localhost:8848/nacos/index.html#/
logininsert image description here

Guess you like

Origin blog.csdn.net/qq_45001053/article/details/131192909