Cluster Mode Deployment

This Quick Start Manual is to help you quickly download, install and use Nacos on your computer to deploy the cluster mode for production use.

Cluster Deployment Architecture

Therefore, when it is open source, it is recommended that users put all server lists under a vip and then hang under a domain name.

Http://ip1:port/openAPI Directly connected to ip mode, the machine needs to be modified to use ip.

Http://VIP:port/openAPI Mount the VIP mode, directly connect to vip, the following server ip real ip, readability is not good.

Http://nacos.com:port/openAPI Domain name + VIP mode, good readability, and easy to change ip, recommended mode

deployDnsVipMode.jpg

1. Preparing for the Environment

Make sure that it is installed and used in the environment:

2. Download source code or installation package

You can get Nacos in two ways.

Download source code from Github

  1. unzip nacos-source.zip
  2. cd nacos/
  3. mvn -Prelease-nacos clean install -U
  4. cd nacos/distribution/target/nacos-server-0.8.0/nacos/bin

Download Compressed Packet after Compilation

Download address

zip package

tar.gz package

  1. unzip nacos-server-0.8.0.zip or tar -xvf nacos-server-0.8.0.tar.gz
  2. cd nacos/bin

Configuration Cluster Profile

In the Nacos decompression directory Nacos / conf directory, there is a configuration file cluster. conf, please configure each line as ip: port.

  1. # ip:port
  2. 200.8.9.16:8848
  3. 200.8.9.17:8848
  4. 200.8.9.18:8848

4. Configure MySQL database

production and use recommendations at least backup mode, or high availability database.

Initialize MySQL database

sql statement source file

application. properties configuration

application.properties configuration file

5. start server

Linux/Unix/Mac

Start commands (cluster mode in parametric mode):

sh startup.sh

6. Service Registration & Discovery and Configuration Management

Service registration

curl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'

Service discovery

curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instances?serviceName=nacos.naming.serviceName'

Publish configuration

curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"

get configuration

curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"

  • shut down server
    Linux/Unix/Mac

sh shutdown.sh