“This is the second day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021”

Installation of basic services

  • Install the JDK and configure the environment variables
  • Install Maven and configure the environment variables
  • Install git

Nacos – download server

Note that nacos-Server and Nacos-client are not the same thing

Install using source code

  • Use Git to download the source information
git clone https://github.com/alibaba/nacos.git
cd nacos/
mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U  
ls -al distribution/target/

// change the $version to your actual path
cd distribution/target/nacos-server-$version/nacos/bin
Copy the code
  • Go to Github and download it yourself or use the link to download it directly

MVN -prelease -nacos -dmaven.test. skip=true clean install -u ls -al distribution/target/

In fact, is recommended this way, because for the later understanding of the whole project will be helpful, you can view the source code at any time. However, the process of compiling the source code requires downloading many JAR files, as well as some configuration information based on the native, so it is not always the desired effect. So if you can’t figure it out, proceed with the following installation using the generated server package

Install using a compressed package

Download directly after decompression can be used

Use and validity test

Start the

Linux/Unix/Mac

Startup command (standalone stands for standalone mode, not cluster mode):

sh startup.sh -m standalone

If you are using an Ubuntu system, or running the script displays an error message indicating that the [[symbol cannot be found, try the following: bash startup.sh -m standalone

Windows startup command (standalone stands for standalone mode, not cluster mode):

Startup. Cd-m standalone — standalone

The validation test

Execute the test examples provided on the website in turn

(7) Failed to connect to 127.0.0.1 port 8848: Connection refused

Service registry: curl -x POST ‘http://127.0.0.1:8848/nacos/v1/ns/instance? ServiceName = nacos. Naming. ServiceName&ip = 20.18.7.10 & port = 8080 ‘- ok

Service discovery: curl -x GET http://127.0.0.1:8848/nacos/v1/ns/instance/list? ServiceName = nacos. Naming. ServiceName ‘- {“name”:”DEFAULT_GROUP@@nacos.naming.serviceName”,”groupName”:”DEFAULT_GROUP”,”clusters”:””,”cacheMillis”:10000,”hosts”: [{” instanceId “, “20.18.7.10 # 8080 # DEFAULT# DEFAULT_GROUP @ @ nacos. Naming the serviceName”, “IP” : “20.18.7.10”, “port” : 8080, the “weight” : 1.0, “healthy” : true, “enabled” : true, “ephemeral” : true, “clusterName” : “DEFAULT”, “serviceName” : “DEFAULT_GROUP @ @ nacos. Naming. Se rviceName”,”metadata”:{},”instanceHeartBeatInterval”:5000,”instanceIdGenerator”:”simple”,”instanceHeartBeatTimeOut”:1500 0,”ipDeleteTimeout”:30000}],”lastRefTime”:1635738389314,”checksum”:””,”allIPs”:false,”reachProtectionThreshold”:false,”v alid”:true}

Release configuration: curl -x POST “http://127.0.0.1:8848/nacos/v1/cs/configs? DataId = nacos. CFG. DataId&group = test&content = HelloWorld “- true

Access to configuration: curl -x GET http://127.0.0.1:8848/nacos/v1/cs/configs?. DataId = nacos. CFG. DataId&group = test “- the HelloWorld

Close:

Linux/Unix/Mac sh shutdown.sh

Windows shutdown.cmd

Or double-click the shutdown.cmd file to run it.

Enabling a Firewall Port

firewall-cmd --zone=public --add-port=8848/tcp --permanent

firewall-cmd --reload
Copy the code

External access, the browser input: http://yourIp:8848/nacos/v1/ns/instance/list? serviceName=nacos.naming.serviceName