Spend small money, peripheral tour, grab immediately, please pay attention to the public number: love to order not to order

Author: Don Juan

preface

Nacos supports DNS – and RPC-based service discovery (as a registry for SpringCloud), dynamic configuration (as a configuration center), and dynamic DNS services. IO /zh-cn/docs/…

We have been paying attention to Nacos for more than half a year, and this project is very active now, which is used by a number of big companies such as Ali and Huya. On March 15th, WE saw the official release of Nacos 1.0.0-RC1, and now it is 1.0.0-RC2. Just now, the company plans to develop a new project, and decides to introduce Nacos, so that other team members can quickly get started. Organize into a series of documents, here is also convenient for other first try partners, but also welcome you to exchange more.

Download, install, and start

There are two ways to obtain Nacos: source code and distribution package. Both of them are very simple. The distribution package method can be referred to the official documentation.

git clone https://github.com/alibaba/nacos.git
cd nacos/
mvn clean install -Prelease-nacos -U 
// change the $version to your actual path
cd distribution/target/nacos-server-$version/nacos/bin // To start the standalone service, double-click startup. CMD on Windows or run the sh startup.sh -m standalone command on Linux/Unix/MacCopy the code

Note: I encountered a script error while booting

Sh startup. Sh -m standalone tanghuang@bogon:command not found
: command not found
: command not found:
'tartup.sh: line 19: syntax error near unexpected token `in
'tartup.sh: line 19: `case `uname` in
Copy the code

This is because script files written in Windows cannot be formatted in Linux

Solution: Open the script file using vi and enter the script file in command mode

set ff=unix
Copy the code

After successful startup, you can see:

http://127.0.0.1:8848/nacos/

Run the sh shutdown.sh command to shutdown the service. On Windows, double-click shutdown.cmd.

To change the port (for example, 9090), change shutdown.sh or shutdown. CMD and add a line:

set "JAVA_OPT=%JAVA_OPT% --server.port=9090
Copy the code

You can also add in the application.properties file under the conf file:

server.port=9090
Copy the code

As for the login user name and password, we have not found a way to change the single startup mode. In cluster mode, we can change the database data. We will try again later.

Perfect. It’s a very simple process. The next chapter starts with registering and discovering Nacos services with me.