nacos cluster deployment

deployDnsVipMode.jpg

 

1. preliminary environmental preparation

Make sure that is installed in the environment:

  1. 64 bit OS Linux / Unix / Mac, Linux systems are recommended.
  2. 64 bit JDK 1.8+; download . Configuration .
  3. Maven 3.2.x +; download . Configuration .
  4. Three or more than three Nacos nodes in order to constitute a cluster.

2. Source download or installation package

You can get Nacos in two ways.

Download the source code from Github way

unzip nacos1.0.1.zip
cd nacos/
mvn -Prelease-nacos clean install -U  
cd nacos/distribution/target/nacos-server-1.0.1/nacos/bin

After downloading the archive compiled mode

download link

zip package

tar.gz 包

  unzip nacos-server-1.0.1.zip 或者 tar -xvf nacos-server-1.0.1.tar.gz
  cd nacos/bin

3. Configure the cluster configuration file

In Nacos of confa directory cluster.conf.example, you can directly exampleextensions removed to use, you can also create a separate cluster.conffile and then open Nacos instance address the follow-up configurations to deploy here, please each row configured ip: port. (3 configure three or more nodes)

# ip:port
200.8.9.16:8848
200.8.9.17:8848
200.8.9.18:8848

4. Configure MySQL database

Production using the recommended at least standby mode, or employs a highly available database.

MySQL database initialization

sql statement source file

application.properties Configuration

Additional profile database in the configuration file

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

 

The reverse proxy configuration nginx

upstream nacosserver{
        server 200.8.9.16:8848;
        server 200.8.9.17:8848;
        server 200.8.9.18:8848;
    }

    server {
        listen       8848;
        server_name  localhost;


        location /nacos/ {
            proxy_pass http://nacosserver/nacos/;
        }

    }

 

6. Start the server

Linux/Unix/Mac

Start command (no parameter model, the cluster model): each started service on each server.

cd nacos/bin

sh startup.sh

Guess you like

Origin www.cnblogs.com/shiraishi/p/11199680.html