Regarding the slow download speed of Nacos and the problem that it cannot be started under windows

1. Background

Recently, I have used Nacos in my work, and I am going to abandon Eureka, so I am going to start learning Nacos, so I want to build a single-service Nacos locally (in the windows environment), but when downloading the package from the Nacos official website, due to network or other reasons As a result, the download cannot be downloaded, and it cannot be started after finally finding a way, so record it here and share it with everyone, hoping to help everyone.

Two, download

  • Official website download address: https://github.com/alibaba/nacos/releases
    Since the official website download is very slow and easy to fail, the author uses the following download method.

  • Download in your own way (recommended): https://gitee.com/mirrors/Nacos
    insert image description here
    Note: If you do not have a gitee account, you must register first, otherwise you will not be able to download.

3. Unzip and pack

3.1 The decompressed file looks like this:

insert image description here

3.2 Packaging

Open cmd in this directory, and execute the following command to start packaging. Of course, you must first configure the maven environment variables first.

mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U 

3.3 Find the packed package

insert image description here
insert image description here
insert image description here

3.4 Unzip the zip package instead of the tar package, the tar package is a package under Linux

When decompressing the zip, pay attention that there should be no Chinese on the decompression path. After decompression, enter the bin directory and double-click startup.cmd, and an error will be reported. The error is caused by the lack of configuration of nacos.core.auth.plugin.nacos.token.secret.key.
After checking on the nacos official website, it is found that this is the reason: https://nacos.io/zh-cn/docs/v2/guide/user/auth.html , that is to say, the nacos version has no default value after 2.2.1, and the author The version is 2.2.1, so the default value needs to be configured here.

3.5 Error correction and default configuration

According to the official prompt as follows:
insert image description here
Then the author used this Base64 shortcut to generate an encrypted string, the shortcut is this https://www.sojson.com/base64.html

3.6 Configure the value just now into the configuration file of Nacos

Find the conf directory in the directory after nacos decompression, and then open the application.properties file under conf. Assign a value to the nacos.core.auth.plugin.nacos.token.secret.key property inside, and assign the generated string here. as follows:

nacos.core.auth.plugin.nacos.token.secret.key=cm9vdENvbmZpZ3Jvb3RDb25maWdyb290Q29uZmlncm9vdENvbmZpZwog

3.7 Save and start Nacos

Startup method 1: Double-click startup.cmd in the bin directory
Startup method 2: Open cmd in the bin directory, and then enter the command: startup.cmd -m standalone

3.8 Login Verification

insert image description here
Enter http://172.1.26.184:8090/nacos/index.html in the browser, where the port number can be changed according to your needs. The port number here is the author's own port number.
insert image description here
Then enter the default username and password, the username is nacos, and the password is also nacos, and you can log in successfully.
insert image description here

Reference blog: https://blog.csdn.net/Passer_hua/article/details/125941453
Explanation: The content of this article is tested by the author and is valid. If there is any inappropriateness, I hope you will not hesitate to tell me. correct.

Guess you like

Origin blog.csdn.net/qq_41774102/article/details/129707999